Created
October 7, 2016 15:52
-
-
Save ejcer/9614afecdb0acf77a86097dc77d88bc3 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
#unpythonic code in idiom_tests_copy.py: | |
result = [] | |
for i in range(10): | |
s = i ** 2 | |
result.append(s) | |
print(sum(result)) | |
#pythonic code that I was attempting to transform idiom_tests_copy.py into: | |
result = [i**2 for i in range(10)] | |
print(sum(result)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment