elif


Definition
elif only executed when the if statement return false.

Syntax
if......:
   ...............
elif condition statement-----
    statement

Parameters
N/A 

Example
elif statement subject to if argument  and input() number  
Here in this sample code the variable assigned the numeric ranges and and if statement is tested on these variables.
a=range(1,18)
b=range(18,40)
c=range(40,99)
print("Please enter your age")
d=input()
if d is a:
    print("You're authorized to work")
elif d is b:
    print ("You are authorized to work")
else:
    print("You can request accommodation")

>>>
Please enter your age

28
You can request accommodation
>>>

Comments