how to do else if in python code example
Example 1: python if
if num<5:
print('Num less than 5')
elif 5<= num <=9:
print('Num between 5 and 9')
else:
print('Num more than 9')
Example 2: python if elif
num = 20
if num > 30:
print("big")
elif num == 30:
print("same")
else:
print("small")
Example 3: 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}!")
Example 4: if else python
age=int(input("Enter your age:"))
if age<=18:
print("sorry your are not eligible for vote")
elif age>=18:
print("u are eligible for vote")
else:
print("in some how the previou's condition fails else part will run")