Nested Conditions
tags: #python/documentation/python_conditionals
Nested conditions, also known as nested if statements, occur when one or more if statements are placed inside the block of another IF or ELSE statement.
General Syntax
if condition1:
# Code to be executed if condition1 is True
if condition2:
# Code to be executed if both condition1 and condition2 are True
elif condition3:
# Code to be executed if condition1 is True and condition2 is False, but condition3 is True
else:
# Code to be executed if both condition1 and condition2 are False
else:
# Code to be executed if condition1 is False