Question

Write a python function that can find the average of given list of numbers. It prints all numbers whose values is less than t
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Code

#function name finfAverage that recieves the list of numbers
def findAverage(numList):
sum=0;#declare a varibale called sum that initial value is 0 and store the sum of all the element of the lsit
for number in numList:#take one number at time from the list and add to the sum
sum+=number
#find the Average by deviding the sum by len of the list
avg=sum/len(numList)

#print the Average of the list
print("Average is :",avg)


print("\nNumbes below Average are:")
for number in numList:
#this will print the numbers below Average
if(number<avg):
print(number)
print("\n\n")


#call the fucntion findAverage wiht three different list
findAverage([10,25,45,87,9,6,8,52,36])
findAverage([10,20,30,40,50,60,80,90])
findAverage([25,50,45,10,25,20.2])

output

code snap for indentation

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.

Add a comment
Know the answer?
Add Answer to:
Write a python function that can find the average of given list of numbers. It prints...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT