edited by
510 views

1 Answer

0 0 votes

The best way is to how b is copied below. As we can see, a is impacted by any changes we make on c but not b, 

a = [1,2,3]
b=a[:]
c=a

b.append(99)
c.append(4)
print ("a=",a,"b=",b,"c=",c)

outputs 

a= [1, 2, 3, 4] b= [1, 2, 3, 99] c= [1, 2, 3, 4]

 

Related questions

1 1 vote
1 1 answer
1.1k
1.1k views
engy.abdelazeez asked Feb 28, 2019
1,101 views
I’ve heard that it’s hard to visualize the output of random forest models with large trees/forest but I’m finding it hard to understand what the use case for the model i...
1 1 vote
1 1 answer
581
581 views
lopezkev asked Oct 15, 2018
581 views
Given the questions:1. How many different groups of 4 students can be made from a class of 40?and2. How many different lists of 4 students can be made from a class of 40?...
1 1 vote
0 0 answers
409
409 views
0 0 votes
1 1 answer
902
902 views