when I just have a regular list and want to copy this list without changes happening to the other:
sent1=['The', 'dog', 'gave', 'John', 'the', 'newspaper']
sent2 = sent1[:]
sent1[1] = 'monkey'
sent2
['The', 'dog', 'gave', 'John', 'the', 'newspaper']
We can see sent2 is unchanged. However, when I have a nested list such as
text1=[['The', 'dog', 'gave', 'John', 'the', 'newspaper'], ['John', 'is', 'happy']]
text2 = text1[:]
text1[0][1] = 'monkey'
text2
[['The', 'monkey', 'gave', 'John', 'the', 'newspaper'], ['John', 'is', 'happy']]
We see that sent2 IS changed. Can someone explain why this happens in a nested list?
`