Completed 4-12 More Loops
This commit is contained in:
parent
5410aa95a6
commit
a5a7215658
28
Chapter_04/4-12_moreLoops.py
Normal file
28
Chapter_04/4-12_moreLoops.py
Normal file
@ -0,0 +1,28 @@
|
||||
# Exercise 4-12 More Loops
|
||||
# Learning Objective: Use loops to rewrite a version of foods.py from Chapter 4
|
||||
|
||||
'''
|
||||
foods.py
|
||||
_ _ _ _ _ _ _
|
||||
|
||||
my_foods = ['pizza', 'falafel', 'carrot cake']
|
||||
friend_foods = my_foods[:]
|
||||
|
||||
print("My favorite foods are:")
|
||||
print(my_foods)
|
||||
|
||||
print("\nMy friend's favorite foods are:")
|
||||
print(friend_foods)
|
||||
_ _ _ _ _ _ _
|
||||
'''
|
||||
|
||||
my_foods = ['pizza', 'falafel', 'carrot cake']
|
||||
friend_foods = my_foods[:]
|
||||
|
||||
print("My favorite foods are:")
|
||||
for food in my_foods:
|
||||
print(food)
|
||||
print("\nMy friend's favorite foods are: ")
|
||||
for food in friend_foods:
|
||||
print(food)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user