Python Python Basics All Together Now Cleaner Code Through Refactoring

How to solve NameError: name not defined

Hi all i am having a problem with my code after creating the calculate_price function i receive a, NameError: name 'tickets_purchased' is not defined, when i try and run the program and input the number of tickets purchased by the user Imgur

1 Answer

KRIS NIKOLAISEN
KRIS NIKOLAISEN
54,285 Points

It looks like you have both tickets_purchased and ticket_purchased.

Change

ticket_cost = calculate_price(tickets_purchased)

to

ticket_cost = calculate_price(ticket_purchased)

Thank you!!