#!/usr/bin/env python lst01 = (2,4,6,8,9) lst02 = (4,3,4,3,1) print map((lambda x,y: x+y),lst01,lst02) print map((lambda x,y: x-y),lst01,lst02) print map((lambda x,y: x*y),lst01,lst02) print map((lambda x,y: x/y),lst01,lst02) print map((lambda x,y: x/2),lst01,lst02) print map((lambda x,y: x**2),lst01,lst02) print map((lambda x,y: x**y),lst01,lst02) print map((lambda x,y: x+y+1),lst01,lst02) print map((lambda x: x+1),lst01) print map((lambda x: x+1),range(10)) print map((lambda x: chr(x)),range(65,80))
结果: [6, 7, 10, 11, 10] [-2, 1, 2, 5, 8] [8, 12, 24, 24, 9] [0, 1, 1, 2, 9] [1, 2, 3, 4, 4] [4, 16, 36, 64, 81] [16, 64, 1296, 512, 9] [7, 8, 11, 12, 11] [3, 5, 7, 9, 10] [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O']
|