+ 1

How to create a function in python, which takes an array and returns a new array containing the values of the given array provid

How to create a function in python, which takes an array and returns a new array containing the values of the given array provided as a parameter incremented by 1, without modify the original array? For example, The array is: [[1, 2, 3], [4, 5, 6]] The new array: [[2, 3, 4], [5, 6, 7]]

14th Nov 2018, 3:16 PM
Wb Z
Wb Z - avatar
1 ответ
+ 3
For your example: return [[n+1 for n in arr] for arr in array]
14th Nov 2018, 3:34 PM
HonFu
HonFu - avatar