Answer to Question #259909 in Python for maitha

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.


1
Expert's answer
2021-11-02T00:39:29-0400
# 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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog