Question #259909

Write a program with a method named getTotal that accepts two lists that contain numbers as arguments and return the sum of the numbers and their average. Call this method and print the results.


Expert's answer

# Python program to find the sum
# and average of the list

L = [4, 5, 1, 2, 9, 7, 10, 8]


# variable to store the sum of
# the list
count = 0

# Finding the sum
for i in L:
	count += i
	
# divide the total elements by
# number of elements
avg = count/len(L)

print("sum = ", count)
print("average = ", avg)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS