Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created May 16, 2020 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha27/db9432d549b7a16aaed6b209026698e6 to your computer and use it in GitHub Desktop.
Save aniruddha27/db9432d549b7a16aaed6b209026698e6 to your computer and use it in GitHub Desktop.
class Sequence():
def __init__(self):
self.num = 2
def __iter__(self):
return self
def __next__(self):
val = self.num
if val>10:
raise StopIteration
self.num += 2
return val
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment