else if python
word = input('Word: ') # This will ask you to print a word if word == 'hello': # <- If your response is: 'hello' print('world') # <- It will output: 'world' elif word == 'world': # If the response is: 'world' print("Hey, that's my line >:(") # It will print this else: print("Hey buster you gonna say hello or not?") # If sombody prints ANYTHING ELSE other than 'hello' or 'world' # It will output that print statment above! #Hope this helped you!
if elif and else in python
var_one = input("Give me a number: ") var_one = int(var_one) var_two = input("Give me another number: ") var_two = int(var_two) if var_one > var_two: print(f"First number, {var_one} is bigger") elif var_one < var_two: print(f"Second number, {var_two} is bigger") else: print(f"Both numbers are the same : {var_one}")
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?')
python if elif else
boolean1 = (1 != 1) boolean2 = (2 + 2 == 5) boolean3 = (1 == 1) if (boolean1): print("Boolean one is true") elif (boolean2): print("Boolean two is true") else: print("Boolean three may, or may not be true")