Python Nested If-else Condition Example


  • Nested If else

One if-else condition nested under another if-else condition is known as nested if-else. If the outer condition is true, then it will execute the inner condition only when it becomes true.

Program
a = 9 b = 7 c = 3 if(a>b): if(a>c): print("a is greater") else: print("c is greater") else: if(b>c): print("b is greater") else: print("c is greater")
Input
Output