Oct-27-2018, 10:56 AM
You're getting closer. The code is steadily improving. Here are the most pressing, current issues to address:
1. As written, your code will continue the loop if a non-numeric entry has been entered. Continuing skips the rest of the loop body and starts the next iteration of the loop. If you enter "Quit", it will raise an exception, print "Bad Score", and start over without checking the conditional on line 17. To fix this, you can simply move that conditional into the except block of your try...except.
2. Computegrade() isn't doing anything right now. Your loop is currently infinite because of problem #1 and the interpreter is never executing line 68. Once #1 is corrected, you will receive a new error. What Ichabod was stating earlier relates to the Single Responsibility Principal (SRP; or atomicity). A function should do only one thing. Since computegrade() is all about determining the letter grade of a giving decimal, your entire if statement from lines 30 through 59 should be inside of it (remember to update the keywords when you move it all).
3. Line 68 should be inside the loop. Repeating that line will perform all the calculations for the grade because it's calling computegrade() (once #2 is corrected). Once this is corrected, you'll start seeing the letter grade print twice. This will be due to the print() calls inside of computegrade(), which you don't need.
1. As written, your code will continue the loop if a non-numeric entry has been entered. Continuing skips the rest of the loop body and starts the next iteration of the loop. If you enter "Quit", it will raise an exception, print "Bad Score", and start over without checking the conditional on line 17. To fix this, you can simply move that conditional into the except block of your try...except.
2. Computegrade() isn't doing anything right now. Your loop is currently infinite because of problem #1 and the interpreter is never executing line 68. Once #1 is corrected, you will receive a new error. What Ichabod was stating earlier relates to the Single Responsibility Principal (SRP; or atomicity). A function should do only one thing. Since computegrade() is all about determining the letter grade of a giving decimal, your entire if statement from lines 30 through 59 should be inside of it (remember to update the keywords when you move it all).
3. Line 68 should be inside the loop. Repeating that line will perform all the calculations for the grade because it's calling computegrade() (once #2 is corrected). Once this is corrected, you'll start seeing the letter grade print twice. This will be due to the print() calls inside of computegrade(), which you don't need.