0

As a new python learner, I'm quite confused about why the list_2 output isn't[2,4,6,8,10]

list_1=[[1,3],[3,4],[5,8]]
for x in list_1:
    x[0]=1
print(list_1)

list_2=[1,3,5,7,9]
for x in list_2:
    x=x+1
print(list_2)

Output

[[1, 3], [1, 4], [1, 8]]
[1, 3, 5, 7, 9]
Des1gnWizard
  • 477
  • 1
  • 4
  • 13

0 Answers0