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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
#!/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" ) |