Comparison returns True or False
a = "42"
b = 42
print(a) # 42
print(b) # 42
print(a == b) # False
print(a != b) # True
print(b == 42.0) # True
print(None == None) # True
print(None == False) # False
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
a = "42"
b = 42
print(a) # 42
print(b) # 42
print(a == b) # False
print(a != b) # True
print(b == 42.0) # True
print(None == None) # True
print(None == False) # False