Course Content
How to Add a Virtual Environment in Python
0/1
Set
0/1
Python
About Lesson

You can also nest if statements to check conditions within other conditions.

Program 1:Check Person LIC Eligibility using nested if

Python
'''
enter age of a person and check lic eligibility if person age >=18 and <=45
eligible for lic otherwise not 
'''
age=int(input("enter age of a person"))
if age>=18:
    if age<=45:
        print("you are eligible for LIC")
    else:
        print("You are not eligible for LIC")
else:
    print("you are not eligible for LIC")

Program 2: Check Person LIC Eligibility using Logical Operator

Python
'''
enter age of a person and check lic eligibility if person age >=18 and <=45
eligible for lic otherwise not  -- using logical operator
'''
age=int(input("enter age of a person"))
income=int(input("enter income "))

if (age>=18 and age<=45) or income>=500000:
    print("you are eligible for LIC")
else:
    print("You are not eligible for LIC")