Question: 6 CConnecConneConnConCoC community co x https: / / colab . research.goo + Code + Text Changes will not be saved Connect Colab Al < >

6CConnecConneConnConCoC community co x
https://colab.research.goo
+ Code
+ Text Changes will not be saved
Connect
Colab Al
<>
Do not use Python operator in as in in . Use of the keyword in in for loops is fine.
Incorrect use example: if 5 in array 1.
Correct use example: for i in range(12):
Use your best judgement and write the most efficient program you can write.
Part 1: offset cumulative sum (50 marks)
Define the ArrayProcestor class as described above. Then, add a method offset_cumulative sum to the ArrayProcessor class that calculates the cumulative sum, with an offset, of the elements of array attribute and stores the results in the same attrbute. When offset is 0, this method should return a new array where each element at index i is the sum of elements up to 1 in the original array. For example, the cumulative sum of an array with values (12,4,17,-9,0,3) and an offset of 0 is (12,16,33,24,24,27)
12 is the sum up to first element,
12416;
12+4+17101733;
12417-9-33-9-24;
12-417-9-0-24+0-24:
12+4+17-9-03-24+3=27
As mentioned, the offset_cumulative_sum also takes an argument offset. The default value for this argument offset is 0. What this additional argument does is provide an offset to be added at each step of cumulative summing, for example, the cumulative sum of the array from our example with values (12,4,17,9,0,3), with an offset of -3 will be (9,10ColaColCoCConnecConneConnConCoC

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!