Compare numbers, compare strings
examples/boolean/compare_two_numbers.py
x = 2 y = 3 if x < y: print("x is less than y") # x is less than y
examples/boolean/compare_two_strings.py
x = "Snake" y = "Stake" if x < y: print("x is less than y") # x is less than y z = "מלון" q = "בלון" if z < q: print(f"{z} in z is less than {q}") else: print(f"{q} in q is less than {z}") print(x < z) x = "👸" y = "💂" if x < y: print(f"{x} in x is less than {y}") else: print(f"{y} in y is less than {x}")
examples/boolean/compare_two_values.py
print(1 < 2) # True print("1" < "2") # True print(2 < 11) # True print("2" < "11") # False