Created
January 18, 2021 15:56
-
-
Save BetterProgramming/bb8ec8e4d4b48cfb411009dcc9027fb3 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
num=[1,2,3,4,5] | |
result=(i**2 for i in num) | |
print (result) | |
#Output:<generator object <genexpr> at 0x02C584C0> | |
print (list(result)) | |
#Output:[1, 4, 9, 16, 25] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment