+ 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

4th Sep 2020, 12:06 PM
Agt Reda
Agt Reda - avatar
6 ответов
+ 2
Web-Learner Isnt’t it 20 ? cause 1,2,3 is 20 times
5th Sep 2020, 9:29 AM
Agt Reda
Agt Reda - avatar
+ 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
4th Sep 2020, 12:33 PM
Web-Learner
+ 1
Web-Learner but how [1, 2, 3] * 20 how u multiply it
4th Sep 2020, 10:07 PM
Agt Reda
Agt Reda - avatar
+ 1
Web-Learner I already know this but yeah u confused me, nvm ik what is happening
11th Sep 2020, 1:45 PM
Agt Reda
Agt Reda - avatar
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
5th Sep 2020, 1:07 AM
Web-Learner
0
Agt Reda Revice your Python Lessons.
5th Sep 2020, 10:17 AM
Web-Learner