Nested if statements [Python]

 


A nested if statement in Python is an if statement that is inside another if statement. This means that the inner if statement will only be executed if the outer if statement is also true.

Nested if statements are useful for checking multiple conditions and taking different actions depending on the results. For example, the following nested if statement checks if a number is positive and even, and prints a different message depending on the result:


name = input("enter your name")

age = int(input("enter your age"))

ms = input("enter status")


if (name=='Rajesh'):

   if (age>30):

      if(msg='m')

print('select')

Previous Post Next Post