From abbbd101d4811f0f72f977e8558703c1894eee4c Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:08:07 -0500 Subject: [PATCH] Completed 7-5 Movie Tickets --- Chapter_07/7-05_movie_tickets.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Chapter_07/7-05_movie_tickets.py diff --git a/Chapter_07/7-05_movie_tickets.py b/Chapter_07/7-05_movie_tickets.py new file mode 100644 index 0000000..c98f72c --- /dev/null +++ b/Chapter_07/7-05_movie_tickets.py @@ -0,0 +1,19 @@ +# Exercise 7-5 Movie Tickets +# Learning Objective: Use a look with if statements to distinguish between prices based on input. + +has_ticket = False + +prompt = "Welcome to the movies, how old are you? \n\t" + +patron_age = input(prompt) +while has_ticket == False: + if int(patron_age) < 3: + print("Your ticket is free since you're under 3.") + has_ticket = True + elif int(patron_age) >= 3 and int(patron_age) <= 12: + print("Your ticket will be $10. ") + has_ticket = True + elif int(patron_age) > 12: + print("Your ticket is $15") + has_ticket = True +