The Missing Variable
A ticket calculator should add a £12 ticket to a £3 booking fee. Instead, Python stops with a NameError. Read the error message, trace the variable names and correct the fault without changing the calculation.
Reveal a hint (from the printed book)
Compare ticket_price with ticket_prce letter by letter. A NameError often reveals an inconsistent spelling.
Reveal a worked Python solution
One possible implementation. Check the book's tests and try an extension after comparing.
# Challenge 61 - The Missing Variable
# Use one spelling for each variable name.
ticket_price = 12
booking_fee = 3
total = ticket_price + booking_fee
print(f"Total: {total}")Save this Python file ↓