Create a python module file named Averager.py . Student1 took a variable number
ID: 3665606 • Letter: C
Question
Create a python module file named Averager.py. Student1 took a variable number of exams for the semester (it could be 2, it could be 4 or more!).
-Ask the student for their name.
-Ask the student how many exams they took
-Then, ask the student for their exam scores. You’ll need a for loop to do this to keep track of the running average. After every loop iteration, print their current exam score.
Provide a way to print out the results in a nice manner (ex. exam average: 86). Separate each of the results on a different line.
Your results should look something like this. I’ll leave it up to you if you want to make it prettier:
Finished.
Double check whether or average is calculated correctly.
Explanation / Answer
x=0
avg=0
sum=0
while True:
a1 = input ('Please enter name:')
b1= input( 'Please enter number of exams attempted:')
for x in range(0, b1):
c1 = float(input ('Please enter the score:'))
sum = sum + c1
avg= sum/b1
print ('The Class Average',avg)
print ('Your Name:',a1, 'Your Total Average is ',avg)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.