Code viewer for World: Boolean Logic in Practice:...
"""
Topic: Boolean Logic in Practice: Combining Conditions in if Statements
Purpose: Learn how to use boolean logic to make real-world decisions
Output: Shows how multiple conditions control program flow
"""

# -----------------------------
# 1. Example variables
# -----------------------------
age = 20
has_id = True
has_ticket = False

# -----------------------------
# 2. Combining conditions with AND
# -----------------------------
# All conditions must be True
if age >= 18 and has_id:
    print("You are allowed to enter.")
else:
    print("Entry denied.")

# -----------------------------
# 3. Combining conditions with OR
# -----------------------------
# At least one condition must be True
if has_ticket or age < 12:
    print("You can watch the movie.")
else:
    print("Ticket required.")

# -----------------------------
# 4. Using NOT with conditions
# -----------------------------
# NOT reverses the condition
if not has_ticket:
    print("Please buy a ticket.")
else:
    print("Enjoy the show!")

# -----------------------------
# 5. Complex condition combination
# -----------------------------
score = 78
attendance = 82

if score >= 60 and attendance >= 75:
    print("Passed and eligible.")
elif score >= 60 and attendance < 75:
    print("Passed, but attendance is insufficient.")
else:
    print("Failed.")

# -----------------------------
# 6. Notes
# -----------------------------
# 1. Boolean logic uses True and False values.
# 2. 'and', 'or', and 'not' combine conditions.
# 3. Parentheses help clarify complex expressions.
# 4. Conditions are evaluated left to right.
# 5. Clear boolean logic improves readability.