Stuck in nested While loop

Below is the code for my program. I am trying to get this to ask the user if they want to enter a set of test scores. If yes the program runs, Gets the test scores, when the user types end, the loop ends, adds the scores and then gives the average. Then it is supposed to ask if the user wants to add another set of test scores. If yes, it runs again. If not, it stops and has a closing statement.

I have the second while loop inside the main while loop. When I run the code, it does not even run the main while loop. Below is what it shows when I answer y (yes) to the question.

Enter test scores
Enter end to end input
Get entries for another set of scores?  y
Enter your information below
Get entries for another set of scores?  

It does not run the original while loop; which lets the user input scores, hit “end” when finished, calculates the scores, gives the average, and finally asks the user if they want to enter another set of test scores.

Any suggestions? I have the complete code as I have it in PyCharm below.

print("The Test Scores application")
print("Enter test scores")
print("Enter end to end input")

# initialize variables
counter = 0
score_total = 0
test_score = 0
get_entries = 'y'
while test_score != 999:
    while True:
        get_entries = input("Get entries for another set of scores?  ")
        if get_entries == 'y':
            print("Enter your information below")
            print("Thank you for using the Test Scores application. Goodbye!")
    test_score = input("Enter test score: ")

    if test_score == 'end':
    elif (int(test_score) >= 0) and (int(test_score) <= 100):
        score_total += int(test_score)
        counter += 1
    elif test_score == 999:
        print("Test score must be from 0 through 100. Score discarded. Try again.")

    # calculate average score
average_score = round(score_total / counter)

# format and display the result
print("Total Score:", score_total,
      "nAverage Score:", average_score)


Your inner loop is indented too far. while True: has 5 spaces before it, while everything else is indented by 4 spaces. Also, while we’re talking about indentation, you have a break that is incorrectly indented too.

To fix this:

  • delete one space from before while True:
  • add three more spaces before break
  • for bonus points, also delete one space from before each of the 5 lines inside the nested while so that they are indented by 8 or 12 spaces.

Hint for the updated question:

Look at the implementation of your inner loop. Under what circumstances would the program exit that loop to continue on to test_score = ...?