1print("Welcome to Rolercoster rider")
2print()
3#taking input of your hight
4Your_hight = int(input("What is Your hight:- "))
5#if condition
6if Your_hight >= 120:
7 print("You are good to go to the roller coster")
8else:
9 print("Grow taller to go to the rolercoster")
1The elif statement allows you to check multiple expressions for TRUE
2and execute a block of code as soon as one of the conditions evaluates
3to TRUE. Similar to the else, the elif statement is optional. However,
4unlike else, for which there can be at most one statement, there can
5be an arbitrary number of elif statements following an if.
6
7if expression1:
8 statement(s)
9elif expression2:
10 statement(s)
11elif expression3:
12 statement(s)
13else:
14 statement(s)
15
1word = input('Word: ') # This will ask you to print a word
2
3if word == 'hello': # <- If your response is: 'hello'
4 print('world') # <- It will output: 'world'
5
6elif word == 'world': # If the response is: 'world'
7 print("Hey, that's my line >:(") # It will print this
8else:
9 print("Hey buster you gonna say hello or not?")
10# If sombody prints ANYTHING ELSE other than 'hello' or 'world'
11# It will output that print statment above!
12
13#Hope this helped you!
1num = 20
2if num > 30:
3 print("big")
4elif num == 30:
5 print("same")
6else:
7 print("small")
8#output: small
1def function(a):
2 if a == '1':
3 print ('1a')
4 elif a == '2':
5 print ('2a')
6 else:
7 print ('3a')
8