From c4b42694d56d24c653bfe45e0daf5a07319abb36 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Tue, 21 Jan 2025 14:48:37 -0500 Subject: [PATCH] Completed 4-13 Buffet --- Chapter_04/4-13_buffet.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Chapter_04/4-13_buffet.py diff --git a/Chapter_04/4-13_buffet.py b/Chapter_04/4-13_buffet.py new file mode 100644 index 0000000..0a9c36d --- /dev/null +++ b/Chapter_04/4-13_buffet.py @@ -0,0 +1,15 @@ +# Exercise 4-12 Buffet +# Learning Objective: Use tuple, list it with for loop and reassign it. + +buffetFoods = ('carrots', 'potatoes', 'salad', 'beef', 'chicken') +print("The buffet offers the following foods:") +for food in buffetFoods: + print(food) +#try to modify to ensure error shows up: +# buffetFoods[3] = 'pork' ---> Confirmed error raised + +#menu changed: +buffetFoods = ('carrots', 'string beans', 'corn', 'beef', 'chicken') +print("\nThe buffet now offers the following foods: ") +for food in buffetFoods: + print(food)