+ 1
Find the number to times the loop goes
6 Respuestas
+ 3
You're using the wrong quote style. I dont know what: ’ is but you need to use either " or '.
NOT ’
+ 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>.
+ 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!
+ 2
Ipang my teacher told that the loop goes 0 times. Can anyone explain.
+ 1
Lothar thanks. This is my another account. I am already a user of solo learn
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.