Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input()) # takes n = total number of inputs
- tokens = input().split() # takes n inputs in to an Array
- sum = 0.0 # variable to store the sums of inputs
- # 1 loop to run the average
- i = 1
- while (i <= n):
- sum = sum + int(tokens[i - 1]) # updates the sum with the new inputs
- # Formatted printing for matching Output
- if (sum % i == 0):
- print('%.0f' % (sum / i))
- else:
- print('%.10f' % (sum / i))
- i = i + 1
Add Comment
Please, Sign In to add comment