1usrinput = input(">> ")
2if usrinput == "Hello":
3 print("Hi")
4elif usrinput == "Bye":
5 print("Bye")
6else:
7 print("Okay...?")
8
1# IF ELSE ELIF
2
3print('What is age?')
4age = int(input('number:')) # user gives number as input
5if age > 18:
6 print('go ahead drive')
7elif age == 18:
8 print('come personaly for test')
9else:
10 print('still underage')
11
1if my_condition:
2 # Do some stuff
3 print("Hello You!")
4else:
5 # Do some stuff
6 print("Hello World!")
1x = True
2
3#Only one of the branches will ever execute
4if x == True:
5 print("x is true")
6elif x == False:
7 print("x is false")
8else:
9 print("x is neither true nor false")