Nested Conditional Statements

Learn what nested conditional state

We have already covered the if, elif, elseif, and else statements, but there are situations where we want to check for a secondary condition if the first condition is evaluated as True. In such cases, we can define an if..else statement inside of another if..else statement. This is called nesting of conditional statements.

Python Syntax:

if statement:
    print("outer if statement")
    if nested_statement:
        print("nested if statement")
        print("nested else statement")
    print("outer else statement")

Let’s again take the example of determining the student grade, but now we would be nesting conditional statements to check a secondary condition of a passing or failing grade.


Get hands-on with 1200+ tech skills courses.