Menu

(Solved) : Really Struggling Computer Science 2 Days Assignment Take Time Q44049498 . . .

1. implement the function flip_sign(data_list, index), which updates the provided list according to these rules: a. if the in

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] Show transcribed image text 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]

Expert Answer


Answer to I am really struggling with Computer Science. (I have 2 days for the assignment so just take your time.)…

OR