+ 1

Find the number to times the loop goes

https://code.sololearn.com/cn4sqX2enHW8/?ref=app

27th Aug 2021, 12:44 PM
Santhos RAJ 14
6 Respuestas
+ 3
You're using the wrong quote style. I dont know what: ’ is but you need to use either " or '. NOT ’
27th Aug 2021, 12:47 PM
Slick
Slick - avatar
+ 3
1. You used slanted single quotes, don't, just use regular single / double quotes for strings. 2. Your code, after the quotes fixed will never end. It's an infinite loop, cause you add 'a' to <l1> which itself is <l>.
27th Aug 2021, 12:49 PM
Ipang
+ 3
Santhos RAJ 14 , before you do some trials in python, it would be helpful for you to start working through a python tutorial. as i have seen, you have not started any of them. i would recommend you to start with the "python for beginners" happy coding and good success!
27th Aug 2021, 1:35 PM
Lothar
Lothar - avatar
+ 2
Ipang my teacher told that the loop goes 0 times. Can anyone explain.
27th Aug 2021, 4:33 PM
Santhos RAJ 14
+ 1
Lothar thanks. This is my another account. I am already a user of solo learn
27th Aug 2021, 4:34 PM
Santhos RAJ 14
0
Santhos, To confirm the infinity of the loop, you can add print outs inside the loop. l = ['a'] l1 = l # <l1> and <l> are for i in l: print(len(l)) l1.append('a') print(i) # non reachable line The code ends with 'No output' because SoloLearn limits the runtime of our code, for security reasons.
27th Aug 2021, 4:47 PM
Ipang