Skip to content

Instantly share code, notes, and snippets.

@thecraftman
Last active July 2, 2021 11:54
Show Gist options
  • Save thecraftman/e5d94a2ed11d5e8bf2c050d5abac80b3 to your computer and use it in GitHub Desktop.
Save thecraftman/e5d94a2ed11d5e8bf2c050d5abac80b3 to your computer and use it in GitHub Desktop.
Generating from list comprehension
# list comprehension
my_nums = [x*x for x in [1, 2, 3, 4, 5]]
print my_nums
for num in my_nums:
print num
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment