Completed 4-13 Buffet
This commit is contained in:
parent
a5a7215658
commit
c4b42694d5
15
Chapter_04/4-13_buffet.py
Normal file
15
Chapter_04/4-13_buffet.py
Normal 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)
|
||||||
Loading…
x
Reference in New Issue
Block a user