Completed 4-13 Buffet

This commit is contained in:
cheeks 2025-01-21 14:48:37 -05:00
parent a5a7215658
commit c4b42694d5

15
Chapter_04/4-13_buffet.py Normal file
View File

@ -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)