Skip to content

Instantly share code, notes, and snippets.

@NimaBavari
Last active November 19, 2020 19:55
Show Gist options
  • Save NimaBavari/d6f05adf1538719f73aef5a04357f7eb to your computer and use it in GitHub Desktop.
Save NimaBavari/d6f05adf1538719f73aef5a04357f7eb to your computer and use it in GitHub Desktop.
def gen_fun(num):
counter = 1
while counter <= num:
yield counter
counter += 1
for n in gen_func(100):
print(n)
gen_expr = (n for n in range(1, 101))
for n in gen_expr:
print(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment