Home »
Function » Python: Using map to Apply a Function to Sequence Items
Python: Using map to Apply a Function to Sequence Items

{filelink=16210}
def sum(x, y):
return x + y
# Apply function 'sum' to numbers between 1 and 10
print map(sum, [1, 2, 3, 4], [5, 6, 7 ,8])
# apply lambda to the sequence
print map(lambda x:x*x, range(5))
print map(lambda s: s.swapcase(),"Welcom to Python.MesExemples.COM") |
Users who found this page were searching for:
- python using map
- python map filter apply
- apply a selfdefied function dataframe python
- Java: Display 12-hour time format with minutes and AM/PM
- perl even number
- python apply function
- using math class python
- underline text using printWriter