python/foods.py

31 lines
673 B
Python

#my_foods = ['pizza', 'falafal', 'carrot cake']
#friends_foods = my_foods[:]
#print("My favorite foods are:")
#print(my_foods)
#print("\nMy friend's favorite foods are:")
#print(friends_foods)
# Now, we add an item to each list and check to see if each list is correct
my_foods = ['pizza', 'falafal', 'carrot cake']
friends_foods = ['pizza', 'falafal' 'carrot cake']
# This doesn't work
#friends_foods = my_foods
# Instead, use the slice when copying the lists
friends_foods = my_foods[:]
my_foods.append('cannoli')
friends_foods.append('ice cream')
print("My favorite foods are:")
print(my_foods)
print("\nMy friend's favorite foods are:")
print(friends_foods)