Question: Question 1 (8 points) Derive a function in Python called add, that takes an array and modifies it by adding 1 to all the elements.

 Question 1 (8 points) Derive a function in Python called add,
that takes an array and modifies it by adding 1 to all

Question 1 (8 points) Derive a function in Python called add, that takes an array and modifies it by adding 1 to all the elements. Create another function Python called add_V2, which takes an array and returns a new array containing the values of the given array provided as a parameter incremented by 1, without modifying it. In the main part of the program, ask the user to input an array, call the function add and display the modified array. Then call the function add_V2, with the array as a parameter, and display its resulting array. Display the original array to check that it has not changed Both functions must support any type of arrays (dimensions), even for lists that are not arrays (the inside lists are not necessarily the same size)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!