issue with nested try else statement
<p>I am a beginner programmer and am writing a program that converts letter grades to GPA, or GPA to letter grades as entered by the user. I reference two functions to do the conversions in other programs. I am using the try statement to start by assuming it is a letter grade to convert to GPA, and that doesn't work i try the function to convert from GPA to letter grade.</p>

<p>My program works, the only problem is that my else statement always executes, even if I enter something that is not a letter grade or GPA. I am guessing it is something easy that I am not seeing.</p>

<pre><code>#Convert a letter grade to GPA, or GPA to letter grade

from grade_points_to_letter import gpa_converter
from letter_grade_to_grade_point import letter_converter

grade = input('Enter a letter grade or GPA to convert: ')  

while grade != '':
    try:
        grade = grade.upper()
        conversion = letter_converter(grade)
        try:
            conversion = gpa_converter(float(grade))
        except:
            print('You did not enter a valid letter grade or GPA')
    except:
        pass
    else:
        print('Your converted grade is:', conversion)
    grade = input('Enter a letter grade or GPA to convert: ')
</code></pre>

<p>You can use an else statement with try catch. However, checkout how the docs recommends using try catch else. Catch should take an error. You should figure out what kind of error you want to catch. </p>

<p><a href="https://docs.python.org/3/tutorial/errors.html" rel="nofollow">https://docs.python.org/3/tutorial/errors.html</a></p>

<p>Another thing you can do is use a debugger to see what you're getting in each block. Just put the following code in the block you want to check out:</p>

<p>import pdb; pdb.set_trace()</p>

python