Python elif Keyword
Example
If the variable i is controversial, 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 a shorthand for else if.
related pages
Please visit our Python Condition Learn more about conditional statements in Chinese.