Conditional statements are a fundamental aspect of programming, allowing your code to make decisions based on certain conditions. In Python, the primary conditional statements are if , elif (short for "else if"), and else . Let's break down how each of these works.

1. if Statement

The if statement is used to execute a block of code if a certain condition is true.

if condition:
    # code to execute if the condition is true

2. elif Statement

The elif (else if) statement follows an if statement and provides another condition that is checked if the previous conditions were false.

if condition1:
    # code if condition1 is true
elif condition2:
    # code if condition2 is true

3. else Statement

The else statement catches anything which isn't caught by the preceding conditions.

if condition:
    # code if condition is true
else:
    # code if condition is false

Consider this diagram of how information flows:

Example using Truth Tables and Comparison Operators:

height = 150  # in centimeters
age = 14      # in years

# Requirements: Height greater than or equal to 140cm and age greater than or equal to 12
if height >= 140 and age >= 12:
    print("You're eligible to ride the roller coaster!")
else:
    print("Sorry, you do not meet the height and age requirements.")

In this code: