/* */ Click to Join Live Class with Shankar sir Call 9798158723

Python Nested if else Statement

A statement that contains other statements is called a compound statement. to perform more complex checks if statements can be nested that is can be placed one inside the other. in such a scase the inner if statements is the statement part of the outer one nested if statements are used to check if more than one condition is satisfied.

Syntex of python if else statement

      [Block C]

     [Block D]

[Block E]

Note: "if the cond1 is evaluated to true, the next inner if statement is executed. The cond2 is checked for true or false. if it is evaluated to true, then the statement in block C are executed otherwise, the statements in BlockD are executed.If above cond1 is not true then statement in Block E is executed."

Q.) W.A.P to print the greater number using simple if-else statement.
a=int(input("Enter first Number"))
b=int(sinput("Enter Second Number"))
if a>b: 
     if a>c:
     print(“Max =%d”,a); 
     print(“Max = %d”,c);
     if b>c:
     print(“Max =%d”,b);
enter three numbers:3 4 5
Max= 5