What is the term elif for in Python? | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

What is the term elif for in Python?

I have a question about the term elif in python, I don't quite understand what it's for. I would also like to ask if I could continue using elif and else and would not change anything?

14th Apr 2020, 1:54 AM
Martiniano Argumedo
Martiniano Argumedo - avatar
2 Respuestas
+ 1
It's short for "else if". if "condition": #code elif "condition": #code else: #code
14th Apr 2020, 2:11 AM
ChaoticDawg
ChaoticDawg - avatar
0
Elif in python is Else if and we use it if we have multiple conditions For a simple exemple: a = input() b = input() if a > b: print("a is greater than b") elif b > a: print("b is greater than a") else: print("both a and b are equal")
14th Apr 2020, 2:14 AM
Oussama Ben Sassi
Oussama Ben Sassi - avatar