Last active
March 30, 2024 22:52
-
-
Save normanlmfung/43267b625335ad0f95dace6e6fd60546 to your computer and use it in GitHub Desktop.
python_syntax_map
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
nums = [ 1,2,3,4,5 ] | |
squares = [] | |
for num in nums: | |
squares.append(num**2) | |
# instead of loop, use 'map' | |
squares = list(map(lambda num: num ** 2, nums)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment