+ 10

what is a result

def add_five(x): return x + 199 nums = [111, 22, 33, 449, 55] result = list(map(add_five, nums)) print(result)

30th Apr 2018, 6:47 PM
Shubham goyal
Shubham goyal - avatar
2 Réponses
+ 4
The map function just applies add_five() to every element of ‘nums’ and then list() makes an array from the resulting numbers. So, ‘result’ will store the following list: [310, 221, 232, 648, 254] (Just every number from ‘nums’ plus 199)
30th Apr 2018, 9:04 PM
Ali Zhussupov
Ali Zhussupov - avatar
+ 5
310 221 232 648 254
22nd Jul 2018, 8:02 AM
rohit