77.5k views
1 vote
Write a program that gets five integer test scores from the user, calculates their average, and prints it on the screen. Test your program with the following data: Run 1: 40, 80, 97, 32, 87 Run 2: 60, 90, 100, 99, 95 Run your program and copy and paste the output to a file. Create a folder named, fullname_program2. Copy your source code and the output file to the folder. Zip the folder and upload it to Blackboard.

User Cehm
by
6.5k points

1 Answer

2 votes

Answer:

total = 0

for i in range(5):

score = int(input("Enter a score: "))

total += score

average = total / 5

print("The average is " + str(average))

Step-by-step explanation:

*The code is in Python.

Initialize the total as 0

Create a for loop that iterates five times. Inside the loop, ask the user to enter a score. Add the score to the total (cumulative sum)

After the loop, calculate the average, divide the total by 5

Print the average

User Pixel Rubble
by
6.1k points