'''map:操作可迭代序列 1.函数作为参数 2.lambda表达式作为参数'''#============== 函数作为参数 ===============#map(func或lambda, 可迭代的序列)scores = [55,78,32,97,64,83,66.5]#函数def add(x): return x + 2#函数作为参数result = list(map(add, scores))print(result) #[57, 80, 34, 99, 66, 85, 68.5]print(scores) #[55, 78, 32, 97, 64, 83, 66.5]#============== lambda表达式作为参数==============#map(func或lambda, 可迭代的序列)names = ['Tom', 'Jerry', 'Marry']result = map(lambda name: name.upper(), names)print(list(result)) #['TOM', 'JERRY', 'MARRY']print(names) #['Tom', 'Jerry', 'Marry']