Question: Part A Write a function: named add_one takes 1 argument, a list returns 1 value, a list In this function, you should loop through each

 Part A Write a function: named add_one takes 1 argument, a

Part A Write a function: named add_one takes 1 argument, a list returns 1 value, a list In this function, you should loop through each element of the argument list, add 1 to it, and then return the new list. For example, add_one([1, 2, 3]) should return [2, 3, 4] . No imports! HINT: I would highly recommend constructing a new list, rather than updating the old one. Graded Read Only : import numpy as np np.random seed (7584) list1 = np.random.randint(-100, 100, 10) actuali = listi + 1 pred1 = add_one(listi.tolist() assert set (predl) == set(actuali.tolist() : np.random. seed(68527) Read Only list2 = np.random.randint(-100, 100, 100) actual2 = list2 + 1 pred2 = add_one(list2.tolist()) assert set (pred2) == set(actual2.tolist()

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!