+ 6
Map basically applies an operation (a function or lambda) to each value of an array. For example: arr = [1, 2, 3, 4 5] newarr = list(map(lambda x: x*2, arr)) #newarr=[2, 4, 6, 8, 10] The lambda takes a value x, in this case a member of the array, and returns x*2. Map applies this to all of the values, doubling them all. Hope this clears stuff up. If not, wait for a response from a more seasoned Pythonist.
27th Nov 2017, 1:49 PM
cHampsonR
cHampsonR - avatar