0% found this document useful (0 votes)
14 views1 page

Python Midterm 8

The document contains a Python program that asks the user for the number of tests taken by a student, then prompts the user to input the scores for each test and calculates the average score.

Uploaded by

rowen prather
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

Python Midterm 8

The document contains a Python program that asks the user for the number of tests taken by a student, then prompts the user to input the scores for each test and calculates the average score.

Uploaded by

rowen prather
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 1

# need to ask for students and then ask for number of test taken then ask for scores

and averge them

count = 1
count2 = 1
count3= 0
num_of_test = int(input('How many tests a student had taken? '))
print('n for no, y for yes')
while count != 0:
enter_grade = input('do you want to enter the grade for students? ')
if enter_grade != 'y':
if count3 != 0:
quit()
continue
elif enter_grade == 'y':
test_total = 0
while count2 < num_of_test + 1:
print ('enter the grade for exam', count2, 'for student no. %d:' %count)
test_score = int(input())
test_total += test_score
count2 += 1
average_score = test_total // num_of_test
count2 = 1
count3 += 1
print (' the average of student', count, 'is %.2f' %average_score)
count += 1

You might also like