Create a python program with the following specifications The program asks the u
ID: 3590286 • Letter: C
Question
Create a python program with the following specifications The program asks the user how many test scores to average together (with an appropriate prompt). . If the user asks to enter more than 10 grades, the program should print a message that the user must upgrade to the paid version to average that many grades, and then stop. o o If the user asks to enter 0 grades, the program should print "that was easy!" and then stop. If the user asks to enter a negative number of grades, the program should print a message explaining how entering a negative number of entries is impossible. Sarcasm welcome here, but don't be too hard on the user. o The program then lets the user enter the required number of test grades (one at a time). Any number is fine, negative, positive, or zero. You may assume grades will be integers. o o After entering the correct number of test grades, the program should print the final average of these numbers. Small bonus for a program that provides a running average as scores are being entered. oExplanation / Answer
from __future__ import division
n = int(input("How many test scores to average together? "))
if n > 10:
print("Please upgrade to the paid version to average " + str(n) + " grades.")
elif n == 0:
print("that was easy!")
elif n < 0:
print("Enter a positive integer.")
sumN = 0
for i in range(n):
x = int(input("Enter number " + str(i+1) + " : "))
sumN += x
print("Average so far: " + str(sumN/(i+1)))
print("Final average is : " + str(sumN/n))
# code link: https://paste.ee/p/hndID
This is done along with small bonus part.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.