+ 1
Can someone explain me how it is 120 ?
x = 5 y = 4 z = [1, 2, 3] print(len(x*y*z)) ———————— CODE OUTPUT 60
6 ответов
+ 2
Web-Learner Isnt’t it 20 ? cause 1,2,3 is 20 times
+ 1
x*y=4*5=20.
z*20=[(1,2,3)*20]
#[1,2,3,1,2,3,1,2,3.....1,2,3]
len(z)=60
+ 1
Web-Learner but how [1, 2, 3] * 20 how u multiply it
+ 1
Web-Learner I already know this but yeah u confused me, nvm ik what is happening
0
Agt Reda
String and List can multiply.
For example:
"Hi"*2="HiHi"
[1,2]*3=[1,2,1,2,1,2]
So
len([1,2,3]*20)=60