What is the difference between else and elif construct of if statement?
Answers
Answered by
76
Answer:
please please mark me as a brainlist answer
Explanation:
The elif is short for else if. It allows us to check for multiple expressions. If thecondition for if is False , it checks the condition of the next elif block and so on. If all the conditions are False , the body of else is executed.
Answered by
3
Answer:
else evaluate a single statement before closing the loop
elif allow you to evaluate multiple statement before closing the loop
elif condition:
statement
used because of more condition are present in the program
number=int(input("enter a number")
if number >0:
print ("number is positive")
elif number<0:
print (" number is negative")
else:
print (" number is zero")
Similar questions