Last active
February 3, 2017 14:53
-
-
Save akitotakeki/4cca4287d418fdec757cbf3e76377360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def square_gen(num): | |
for i in range(num): | |
yield i**2 | |
gen = square_gen(5) | |
for i in gen: | |
print(i) | |
for i in map(lambda x: x**2, range(5)): | |
print(i) | |
squares = (x ** 2 for x in range(5)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment