num = 20 if num > 30: print("big") elif num == 30: print("same") else: print("small") #output: small
answer = input(":") if answer == "lol": print("haha") else: print("not haha") exit() please note that the exit() command is optional and is not necessary.
if (condition1): print('condition1 is True') elif (condition2): print('condition2 is True') else: print('None of the conditions are True')
if (condion): result elif (condition): results else: result
>>> a = 5 >>> if a > 5: ... a = a + 1 ... elif a == 5: ... a = a + 1000 ... else: ... a = a - 1 ... >>> a 1005