26,289 views
30 votes
30 votes
What is elif? How does it work in python?

User Sutee
by
2.8k points

2 Answers

27 votes
27 votes
Use the elif condition is used to include multiple conditional expressions after the if condition or between the if and else conditions
User Krishnamurthy
by
3.0k points
18 votes
18 votes
it is the condition used after the if condition. say you use the if condition and you need to add another outcome, instead of using the if condition again, you’d use elif and end it with the else command.

example:

if num == 10:
print (“correct”)

elif num > 10:
print (“too high”)

else:
print (”too low”)

hope this helps :]
User SDW
by
2.8k points