+ 1
What must be the output of this code? Plzz answer with proper solution......
a=[1,2,3] b=a a.append(10) print(len(b))
3 Antworten
+ 6
The output is 4
a= [1,2,3] #this is a list including three items so len(a)=3
b=a# b is equal to a
a.append( 10)# this adds the item 10 to the end of list a so a= [1,2,3,10]
print (len(b))# now len(a) = 4
a=b so len(a)= len(b)= 4
Hope this helps 🙂
+ 3
If only sololearn had a code playground..
+ 2
Please tag Python, as that is the language relevant to your question. 'plzz' doesn't bear any relevance with your question topic.
For future reference follow this guide to posting a question 👍
https://www.sololearn.com/Discuss/333866/?ref=app