Answer to Question #202777 in Python for Dayan Ibrar

Question #202777

compute average numbers from 1 to n where n is a positiove integer value and assign it to the variable avg in python


1
Expert's answer
2021-06-03T13:41:56-0400
n = int(input())
sum = 0
for i in range(1, n + 1):
    sum += i
avg = sum / n 
print('avg =', 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
APPROVED BY CLIENTS