2.1.2 Two-Way Decisions with if-else

Unit: Unit 2: Decision Making & Conditionals • Interactive Practice

Quick Answer & Summary:

Interactive Python programming tutorial and practice in your browser.

Interactive Challenge (Run Live in Browser):

# Check access permission
user_age = 16
minimum_age = 18

if user_age >= minimum_age:
    print("Access granted: Welcome to the portal.")
else:
    years_left = minimum_age - user_age
    print("Access denied: You must wait", years_left, "more years.")
Open in Live Interactive Python Sandbox →