num_l = [1, 3, 6, 8]
num_2 = [3, 90, 60, 8]
def map_test(func, array):
ret = []
for i in array:
t = func(i)
ret.append(t)
return ret
print('自定义函数:',map_test(lambda x:x+1, num_2))
print('内置函数:',list(map(lambda x:x+1,num_2)))
D:\Python\Python36\python.exe D:/Python_test/day_lesson/test.py
自定义函数: [4, 91, 61, 9]
内置函数: [4, 91, 61, 9]
Process finished with exit code 0