how to do if statement python code example
Example 1: if syntax in python
variable_name = input("y/n? >> ")
if variable_name == "y":
print("That's good! :) ")
# note the double equal signs. only a single equal sign will receive a Syntax error blah blah blah message.
elif variable_name == "n":
print("That's bad! :( ")
else:
print("You blow up for not following my instructions. Detention forever and get lost!")
Example 2: python or in if statement
weather = input("How's the weather? ")
if weather == "Good!" or weather == "Great!":
print('Glad to hear!')
else:
print('Too bad!')