if else Statement in Python

Indentation plays a vital role in Python if else statements.

Example:

#Expecting age value from the employee
strAge = input(
    'Please share your age'
);
#Converting string to integer
intAge = int( strAge );
#Printing the voting ability
if intAge < 18 :
    print(
        'You are not eligible for voting.'
    );
    print(
        'Your session is closing.'
    );
else :
    print(
        'You are eligible for voting.'
    );
    print(
        'Proceed further for filling the form.'
    );
print( 'Thank you!' );

Leave a Reply