An if statement within another if statement is known as nested if statement. Similarly, any decision logic can be written within an else statement also.
Have a look at the below example of nested if:
num1=10 num2=20 num3=30 if(num1>num2): if(num1>num3): print("num1 is greater") else: print("num3 is greater") elif(num2>num3): print("num2 is greater") else: print("num3 is greater")
num3 is greater
in this above example, one if statement is inside of another if block. It’s good example of nested if statement.