Last active
February 21, 2019 16:32
-
-
Save scandiumby/d5728572bc5901805197f11d3a6da091 to your computer and use it in GitHub Desktop.
Bad example for use map/lambda in Python3
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
in_list = [1, 2, 3, 4, 5] | |
out_list = list(map(lambda x: (x + 1) if x % 2 == 0 else x, in_list)) | |
print(out_list) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice solution: