python if statement and or code example
Example 1: python if statement
usrinput = input(">> ")
if usrinput == "Hello":
print("Hi")
elif usrinput == "Bye":
print("Bye")
else:
print("Okay...?")
Example 2: or statement python
if x==1 or y==1:
print(x,y)
Example 3: python if statement
if (condition1):
print('condition1 is True')
elif (condition2):
print('condition2 is True')
else:
print('None of the conditions are True')
Example 4: python if
def e(x):
if x == "Sunny" and x == "sunny":
print('Remember your sunglasses!')
elif x == "Rainy" and x == "rainy":
print('Do not forget your umbrella!')
elif x == 'Thunderstorm' or x == 'thunderstorm' or x =='Stormy' or x == 'stormy':
print('Stay Home!')
x = input('What is the weather?')