If/Else Conditions

Control flow allows your code to make decisions. Python uses if, elif, and else for conditional branching.

Basic Syntax

age = 18
if age >= 18:
  print("You can vote")
elif age > 13:
  print("You are a teenager")
else:
  print("You are a child")

Conditions use comparison operators like ==, !=, <, >, <=, >=, and logical operators like and, or, and not.

← PrevNext →