Eryk Sun added the comment:
Did you try the example in Python 2? Did you click on the "next" link in the
preceding paragraph? Please read the following:
https://docs.python.org/2/library/stdtypes.html#iterator.next
iterator.next()
Return the next item from the container
In Pyth
New submission from Hiba:
class Reverse:
"""Iterator for looping over a sequence backwards."""
def __init__(self, data):
self.data = data
self.index = len(data)
def __iter__(self):
return self
def next(self):
if self.index == 0:
raise