Does Python have else if statement ? how to use it ? Syntax please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Does Python have else if statement ? how to use it ? Syntax please

Python

22nd Jan 2018, 2:38 PM
Tejeshwar Pradhan
Tejeshwar Pradhan - avatar
6 Answers
+ 5
Yes. Here it is: if (a > b): print("a > b") elif (a < b): print("a < b") else: print("a = b")
22nd Jan 2018, 2:50 PM
Boris Batinkov
Boris Batinkov - avatar
+ 2
Thanks Bud
22nd Jan 2018, 2:50 PM
Tejeshwar Pradhan
Tejeshwar Pradhan - avatar
+ 2
temperature = float(input('What is the temperature? ')) if temperature > 70: print('Wear shorts.') else: print('Wear long pants.') print('Get some exercise outside.')
26th Jan 2018, 12:35 AM
Marco A. López Sánchez
Marco A. López Sánchez - avatar
+ 2
input("hi, I'm gonna display election result ") highest vote=int (50) lowest vote=into(0) if vote==50: print(" congratulations ") print(" u are the winner") elif vote <50: print("better luck next time")
26th Jan 2018, 5:59 AM
LAWRENCE EHIMHEN
LAWRENCE EHIMHEN - avatar
+ 1
its called `elif ` if 1 < 0: elif 1 > 0 :
22nd Jan 2018, 2:49 PM
Toni Isotalo
Toni Isotalo - avatar
+ 1
elif is pythons else if statement
9th Feb 2018, 10:38 AM
Dexter Cartret