Last active
February 6, 2021 02:10
-
-
Save eriky/01f600524220bf77c235b397fe4bf19e to your computer and use it in GitHub Desktop.
This file contains hidden or 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 some_function(a): | |
return (a + 5) / 2 | |
my_formula = [some_function(i) for i in range(10)] | |
print(my_formula) | |
# [2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0] |
You are right; I fixed it in the gist. Thanks.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Came across this in an article that started with this is Python 3 code but the output above is correct only for Python 2. Output should be:
# [2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0]
or
some_function
should use//