if Statement in Python
Simple if Statement
Simple if is the simplest of all decision making statements. Condition should be in the form of relational or logical expression.
In the above syntax if the condition is true statements - block 1 will be executed.
# Program to check the age and print whether eligible for voting
x=int (input("Enter your age :"))
print ("You are eligible for voting")
Enter your age :34
You are eligible for voting
Enter your age :16
As you can see in the second execution no output will be printed, only the Python prompt will be displayed because the program does not check the alternative process when the condition is failed.