python what is map() code example
Example: map in python
>>> numbers = [1, 2, 3, 4, 5]
>>> squared = []
>>> for num in numbers:
... squared.append(num ** 2)
...
>>> squared
[1, 4, 9, 16, 25]
>>> numbers = [1, 2, 3, 4, 5]
>>> squared = []
>>> for num in numbers:
... squared.append(num ** 2)
...
>>> squared
[1, 4, 9, 16, 25]