Operators are symbols that perform operations on values. Think of them as the “verbs” of programming - they make things happen!You already know most operators from math class:
age = 25has_license = True# AND - both must be truecan_drive = age >= 16 and has_licenseprint(can_drive) # True# OR - at least one must be trueday = "Saturday"is_weekend = day == "Saturday" or day == "Sunday"print(is_weekend) # True# NOT - reverses the valueis_adult = age >= 18is_child = not is_adultprint(is_child) # False
# AND: Both must be Trueprint(True and True) # Trueprint(True and False) # Falseprint(False and False) # False# OR: At least one must be True print(True or False) # Trueprint(False or False) # False# NOT: Flips the valueprint(not True) # Falseprint(not False) # True