Answer to Question #178327 in Python for tas

Question #178327

For this question, alter the code in question 7, count the total numbers in the list, find the average of the numbers in the list and find how many numbers are in the range of 10 - 30. Print the count of the total numbers, an average of the numbers, and the count of the numbers in the range of 10 - 30


1
Expert's answer
2021-04-07T00:18:20-0400
numbers=[5,6,3,52,8,6,2,36,4,16,22,56,23,5,8,9,3,22,29,21,18]
#count the total numbers in the list
totalNumbers=len(numbers)
#find the average of the numbers in the list
average = sum(numbers)/totalNumbers
#find how many numbers are in the range of 10 - 30.
rangeCounter=0
for n in numbers:
    if(n>=10 and n<=30):
        rangeCounter+=1
#Print the count of the total numbers, an average of the numbers
#the count of the numbers in the range of 10 - 30
print(f"The count of the total numbers: {totalNumbers}")
print(f"The average of the numbers: {average}")
print(f"The count of the numbers in the range of 10 - 30: {rangeCounter}")

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
APPROVED BY CLIENTS