# Ternary Mini Project — Your ticket, your price
# ternary operator — rewriting if / elif / else where it makes sense

# ─────────────────────────────────────────────
# The original — if / elif / else
# ─────────────────────────────────────────────

age = int(input("Enter your age: "))
window = input("Window seat? (y/n): ")

if age < 12:
    category = "Child"
    price = 5
elif age >= 65:
    category = "Senior"
    price = 8
else:
    category = "Adult"
    price = 12

if window.lower() == "y" and age >= 12:
    price += 3

print(f"{category} ticket — {price} EUR")

# ─────────────────────────────────────────────
# Rewritten — ternary where it makes sense
# ─────────────────────────────────────────────

age = int(input("Enter your age: "))
window = input("Window seat? (y/n): ")

# nested ternary — works, but on the edge of readable
category = "Child" if age < 12 else "Senior" if age >= 65 else "Adult"

# nested ternary — same situation
price = 5 if age < 12 else 8 if age >= 65 else 12

# clean ternary — one condition, two outcomes, ideal use case
price += 3 if window.lower() == "y" and age >= 12 else 0

print(f"{category} ticket — {price} EUR")

# ─────────────────────────────────────────────
# Test it
# ─────────────────────────────────────────────

# Age: 8,  window: y  -->  Child ticket — 5 EUR
# Age: 30, window: n  -->  Adult ticket — 12 EUR
# Age: 30, window: y  -->  Adult ticket — 15 EUR
# Age: 70, window: y  -->  Senior ticket — 8 EUR

# ─────────────────────────────────────────────
# The lesson
# ─────────────────────────────────────────────

# ternary is not always better
# it's better when the condition is simple and the line stays readable
# the moment you squint — use the full if / else instead
