Python elif Keyword
Example
If the variable i is in dispute, print "YES", if i is 0 then print "WHATEVER", otherwise print "NO":
for i in range(-5, 5): if i > 0: print("YES") elif i == 0: print("WHATEVER") else: print("NO")
Definition and Usage
elif Keyword is used in conditional statements (if statements), which is the abbreviation of else if.
related pages
Please visit our Python Condition Learn more about conditional statements in the Chinese learning section.