Python Else Statement
The else statement in Python allows you to execute a block of code when the condition in the if statement is not met.
Syntax
# Generic version of if-else statementif condition: # Code to execute if the condition is True passelse: # Code to execute if the condition is False passExample
# Concrete example of if-else statementage = 16
if age >= 18: print("You are eligible to vote.")else: print("You are not eligible to vote.")# Output: You are not eligible to vote.