0

Here is my code:

list1 = ["dog", "cat"]
list2 = list1 
list2.append ("fish") 
print(list1)
print(list2)  # both list1 and list2 will be [“dog”, “cat”, “fish”].

I do understand why print(list1)>>> [“dog”, “cat”, “fish”].

But I do not understand why print(list2)>>> [“dog”, “cat”, “fish”].

Could someone explain it please?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Betty
  • 19
  • 3

0 Answers0