Question: I am really struggling with Computer Science. (I have 2 days for the assignment so just take your time.) 1. implement the function flip_sign(data_list, index),

 I am really struggling with Computer Science. (I have 2 days

I am really struggling with Computer Science.

(I have 2 days for the assignment so just take your time.)

1. implement the function flip_sign(data_list, index), which updates the provided list according to these rules: a. if the index is outside the boundaries of the provided list, print "Index out of bounds" and exit b. if the element at the given index is an integer, reverse the sign of the data found there (example: a 9 becomes -9, a-3 becomes 3) c. In all other cases do nothing at all Notice that this function neither prints nor returns a value. The provided data is altered during the test. Verification means examining the provided data after the test runs. Examples: >>> data = [1,2,3,4] >>> flip_sign (data, 1) >>> data [1, -2, 3, 4] >>> flip_sign (data, 7) Index out of bounds >>> data = [1, 2, 3.7, 4] >>> flip_sign (data, 2) >>> data [1, 2, 3.7, 4]

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!