0
Generators in python: not able to print result help me finding bug
def topten(): n=1 while n<=10: sq=n*n yield sq n+=1 values=topten() for i in values: print(i) #Why output not coming help
6 Answers
+ 3
Your code is valid.
It should print squares of numbers.
Maybe the code has wrong indentations which can't be seen here?
Save your code in the code playground and post link here.
+ 1
thanks for ur assistance its working might be code playground maintainence issue running on
+ 1
You should have tried it in interpreter mode !
Try it in the other mode. It's working!
0
yes might be due to runtime error or any indentation mark.
0
actually the application was under maintainence and might be due to that was not printing output even no error appearingi i tried afterwards it worked thankzđđ»