A curated list of beginner‑friendly and interesting Python fun facts, collected during daily practice sessions.
Python uses newlines to end statements.
x = 10
print(x)Semicolons can be used, but they’re not Pythonic.
bool is a subclass of int.
True + True # 2
False + 5 # 5None == 0 # False
None == False # FalseNone means no value, not zero.
"Hi " * 3Output:
Hi Hi Hi
name = "Asma"
nums = [1,2,3,4]
name[::-1] # 'amsA'
nums[::-1] # [4,3,2,1]x = 10**200
print(x)Python can handle very large numbers without overflow.
num = 1_000_000_000
print(num)Underscores don’t affect the value.
r = range(0, 10_000_000_000)range doesn’t store all numbers—values are generated on demand.
def greet(name):
return f"Hello {name}"
say_hi = greet
say_hi("Python")Functions can be stored, passed, and returned like variables.
try:
risky()
except Exception:
print("Error")
else:
print("Success")else runs only if no exception occurs.
d = {"a":1, "b":2, "c":3}
list(d)Output:
['a', 'b', 'c']
a = []
b = a
c = []
id(a) == id(b) # True
id(a) == id(c) # FalseSame values ≠ same object.
a = 100
b = 100
a is b # True
x = 1000
y = 1000
x is y # False (often)Use == for value comparison, not is.
print(...) # Ellipsis
print(type(...)) # <class 'ellipsis'>Used in advanced slicing (e.g., NumPy).
import copy
x = [[1,2],[3,4]]
y = x.copy()
z = copy.deepcopy(x)copy()→ outer list copied, inner lists shareddeepcopy()→ everything copied
✨ End of Fun Facts
This file is part of a continuous Python learning journey.