Implement function reverse that takes a 2D list
(a list of list of integers) and returns...
Implement function reverse that takes a 2D list
(a list of list of integers) and returns a new 2D list where the
items in each row are in reverse order. You maynot use slicing. You
may not modify the input list. The returned list should be
completely new in memory – no aliases with the input 2D list. From
list methods, you may use only the .append().
Examples:
reverse([[1,2,3],[4,5,6]])
-> [[3,2,1],[6,5,4]]
reverse([[1,2],[3,4],[5,6]]) ->
[[2,1],[4,3][6,5]]
True
False
In python please
Implement function swap that takes a 2D list (a
list of list of integers) and modifies...
Implement function swap that takes a 2D list (a
list of list of integers) and modifies it
in-place by swapping the first element in
each row with the last element in that row. The return value is
None. You may not use slicing. You maynot use any list method like
append, insert, etc. Modification must be
in-place, you may not move the list
itself or any of its sublists to a new memory location.
Examples:
reverse([[1,2,3],[4,5,6]])
-> [[3,2,1],[6,5,4]]
reverse([[1,2,3,4],[5,6,7,8]]) ->
[[4,2,3,1],[8,6,7,5]]...