top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Give one example for stop iteration error using next method in python?

+1 vote
625 views
Give one example for stop iteration error using next method in python?
posted Jan 12, 2016 by Gnanendra Reddy

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Try something
def func(iterable):
    while True:
        val = next(iterable)

PS: not tested?

Similar Questions
0 votes
x = range (5)
y = range (5)
for ply in x:
 for com in y:
 if ply==com:
 result="Tie"
 print(ply,com,result)

Why is ply always equal to com?

0 0 Tie
0 1 Tie
0 2 Tie
0 3 Tie
0 4 Tie
1 0 Tie
1 1 Tie
1 2 Tie
1 3 Tie
1 4 Tie
2 0 Tie
2 1 Tie
2 2 Tie
2 3 Tie
2 4 Tie
3 0 Tie
3 1 Tie
3 2 Tie
3 3 Tie
3 4 Tie
4 0 Tie
4 1 Tie
4 2 Tie
4 3 Tie
4 4 Tie
...