Python Elif Statement
Syntax
The elif statement in Python allows for additional conditions to be checked after an initial if condition fails.
if condition1: # Code to execute if condition1 is trueelif condition2: # Code to execute if condition2 is trueelse: # Code to execute if none of the above conditions are trueExample
age = 19
if age < 13: print("You are a child.")elif age < 20: print("You are a teenager.")else: print("You are an adult.")
# Output: You are a teenager.