+ 4

the good answer of this python quiz is "3"; can you explain me why doesn't "2"? a=[1,2] ; b=a ; a.append (3) ; print(len(b))

Questionable quiz answer !!!!

13th May 2019, 4:13 PM
Abdelkader Barraj عبد القادر البراج
Abdelkader Barraj عبد القادر البراج - avatar
4 Answers
+ 10
Because both b and a are referring to same list i.e [1,2,3] Hence ans is 3
13th May 2019, 4:17 PM
Rstar
Rstar - avatar
+ 4
~ swim ~ So , in this case : a=5 b=a a=8 b follow the change in a or keep the value 5 ?
13th May 2019, 4:34 PM
Abdelkader Barraj عبد القادر البراج
Abdelkader Barraj عبد القادر البراج - avatar