1usrinput = input(">> ")
2if usrinput == "Hello":
3 print("Hi")
4elif usrinput == "Bye":
5 print("Bye")
6else:
7 print("Okay...?")
8
1variable_name = input("y/n? >> ")
2if variable_name == "y":
3 print("That's good! :) ")
4# note the double equal signs. only a single equal sign will receive a Syntax error blah blah blah message.
5elif variable_name == "n":
6 print("That's bad! :( ")
7else:
8 print("You blow up for not following my instructions. Detention forever and get lost!")
1#Conditionals statements in python
2#'=' conditionals statements
3a = 123
4b = 123
5
6if(a==b):
7 print('True')
8
9#<, > conditionals statements
10
11a = 2
12b = 45
13
14if(a<b):
15 print('A is smaller than B')
16
17
1a = 200
2b = 33
3c = 500
4
5if a > b and c > a:
6 print("Both conditions are True")
7
8
1if num<5:
2 print('Num less than 5')
3elif 5<= num <=9:
4 print('Num between 5 and 9')
5else:
6 print('Num more than 9')
1answer = input(":")
2if answer == "lol":
3 print("haha")
4else:
5 print("not haha")
6 exit()
7
8please note that the exit() command is optional and is not necessary.