else if python code example
Example 1: python if statement
usrinput = input(">> ")
if usrinput == "Hello":
print("Hi")
elif usrinput == "Bye":
print("Bye")
else:
print("Okay...?")
Example 2: if else python
print('What is age?')
age = int(input('number:'))
if age > 18:
print('go ahead drive')
elif age == 18:
print('come personaly for test')
else:
print('still underage')
Example 3: else if python
word = input('Word: ')
if word == 'hello':
print('world')
elif word == 'world':
print("Hey, that's my line >:(")
else:
print("Hey buster you gonna say hello or not?")
Example 4: else if python
if expression1:
statement(s)
elif expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)
Example 5: else if python
if (condion):
result
elif (condition):
results
else:
result
Example 6: else if python
name = input("What's your name? \n")
if name == "Aguy12":
print("Wait a second...")
elif name == "Aguy11":
print("Now that's definitely not true")
else:
print(f"Hello, {name}!")