The IF & ELIF Statement
Let’s Write Our First Program using if and elif statement.
Open Vi editior as
# vi pyif.py
and Start Typing the below code:
# Pinger Program by Hyp3ri0n
age = 20
print “” Helo Pinger, What is Your Age “”
answer = int(input(“”Enter Your Age Please:””))
if answer == age:
print “”You are a Young Pinger””
elif answer < age:
print “” You are a learning Pinger””
elif answer > age:
print “”You are an Expert Pinger””
:wq (Write and Quit Vi Editior)
Now run the program as following:
#python pyfi.py <—
In above program i have used if and elif statement to explain how they work
age is variable
answer is a variable and requires integer input
Input requires and input
Print will print the statement.
Please do comment !