g Write a general-purpose program with a loop and indexed addressing that calculates sum of the values of elements of a DWORD array that are located at multiple of 4 location. For example for the array 1,2,3,4,5,6,7,8,9,10,11,12,13,14

Relax

Respuesta :

Answer:

def sumD4th(dword):

   select = dword[3::4]

   print(sum(select))

mylist = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]

sumD4th(mylist)

Explanation:

The python program above defines a function called "sumD4th" that accepts a list as its argument. The variable "select" is created which is the subset of the list argument "mylist" containing the index items that is a sum of four. The output of the function is the sum of the items in the "select" list.