Python map () function

Source: Internet
Author: User

Http://www.runoob.com/python/python-func-map.html

Map () function syntax:

Map(function, iterable,...)     
Parameters
  • Function--functions, with two parameters
  • Iterable--one or more sequences
  •  >>>def  Square (x): # squared count  ... return  x * * 2 ...  >>> map (square, [1,2,3,4,5]) #   List of calculations and: 1 +2+3+4+5  [1, 4, 9, 25lambda  x:x * * 2, [1, 2, 3, 4, 5]) #   Using the lambda anonymous function  [1, 4, 9, 25 #  Span style= "color: #008000;" > Two lists are available to add the list data for the same location  >>> map (lambda  x, y:x + y, [1, 3, 5, 7, 9], [2, 4, 6, 8, 10 3, 7, one, +,] 

     

Python map () function

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.