Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

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
  • perl even number
  • apply a selfdefied function dataframe python
  • Java: Display 12-hour time format with minutes and AM/PM
  • python apply function
  • using math class python
  • underline text using printWriter
  • python map filter apply

No comments yet.

Leave a Comment