Why output is 60 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
25th Jul 2020, 3:26 PM
Rahul Kumar
3 Answers
+ 13
x = 5 y = 4 z = [1,2,3] print (len(x*y*z)) The calcultion of len() is based on the multiplication of 5 * 4 = 20. Then list (len = 3) is multiplied with 20. if you do: a = x * y * z a will look like: [1,2,3,1,2,3,1,2,3,...] with a length of 60.
25th Jul 2020, 3:33 PM
Lothar
Lothar - avatar
+ 4
5 * 4 = 20 * 3(length of z)= 60
25th Jul 2020, 3:31 PM
Manish
Manish - avatar
+ 3
5*4*[1,2,3] it will create 60 elements in z(as it iterables) SO the len gives 60
25th Jul 2020, 3:31 PM
v@msi😉
v@msi😉 - avatar