+ 1
Why output is 60
3 Respuestas
+ 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.
+ 4
5 * 4 = 20 * 3(length of z)= 60
+ 3
5*4*[1,2,3] it will create 60 elements in z(as it iterables)
SO the len gives 60