evaluate multiple conditions (or and not)
or = at least one condition must be True
and = both conditions must be True
not = inverts the condition (not False not True)
temp = 25is_raining = Falseif temp > 30or is_raining< 10: print("It's a hot day")else: print("It's a nice day")A one-line shortcut for the if-else statement(ternary operator)
Print or assign one of two values based on a condition
X if condition else Y#语法格式 举例如下
num = 6res = "EVEN"if num % 2 == 0else"ODD"# 奇数偶数a = 5b = 10max_num = a if a > b else b # 寻找最大值