my_foods = [‘pizza’, ‘cake’, ‘beef’]
myfriend_foods1 = my_foods
myfriend_foods2 = my_foods[:]
if( myfriend_foods1 is my_foods):
print (“true”)
else:
print(“false”)
#true
if( myfriend_foods2 is my_foods):
print (“true”)
else:
print(“false”)
#false
my_foods.append(“ice cream”)
print(my_foods) #[‘pizza’, ‘cake’, ‘beef’, ‘ice cream’]
print (myfriend_foods1) #[‘pizza’, ‘cake’, ‘beef’, ‘ice cream’]
print (myfriend_foods2) #[‘pizza’, ‘cake’, ‘beef’]