p

python tutorial - Nested If | Nested If Else Statement - learn python - python programming



 python nestedif

Learn Python - Python tutorial - python nestedif - Python examples - Python programs

  • The if...else statement executes two different codes depending upon whether the test expression is true or false. Sometimes, a choice has to be made from more than 2 possibilities.
  • The nested if...else statement allows you to check for multiple test expressions and execute different codes for more than two conditions.
 nested if else statement python

Syntax:

If statement:  
    Body  
elif statement:  
    Body  
else:  
    Body    

Example:

a=10  
if a>=20:  
    print "Condition is True"  
else:  
    if a>=15:  
        print "Checking second value"  
    else:  
        print "All Conditions are false"

Output:

All Conditions are false.

Wikitechy tutorial site provides you all the learn python , online python programming course python programming class online , python coding for dummies , python programming classes online , online training python , online python training , python programming online course , python training classes

Related Searches to Nested If Else Statement