Feb-12-2018, 06:25 AM
Good evening
The issue i'm trying to solve with this program is I need to convert the code on line 23 to a str value "end" in order to display the average scores.
Thank you very much in advance.
The issue i'm trying to solve with this program is I need to convert the code on line 23 to a str value "end" in order to display the average scores.
Thank you very much in advance.
#!/usr/bin/env python3 # display a welcome message print("The Test Scores program") print() print("Enter test scores") print("Enter 'end' to end input") print("====================") # get scores from the user # initialize the variable for accumulating scores counter = 0 score_total = 0 test_score = 0 choice = "y" while choice.lower() == "y": test_score = int(input("Enter test score: ")) if test_score >= 0 and test_score <= 100: score_total += test_score counter += 1 elif test_score == 999: average_score = round(score_total / counter) print("======================") print("Total Score: ", score_total, "\nAverage Score:", average_score) print() choice = input("Enter another set of test scores (y/n):") if choice =="n": break print() print("Enter test scores") print("Enter 'end' to end input") print("====================") counter = 0 score_total = 0 test_score = 0 continue else: print("test score must be from 0 through 100. Try again.") print("Bye")