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>If you're trying to catch exceptions raised by functions on invalid inputs, probably you would like to rewrite the code to something like this:</p>

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

<p>Also it is recommended to specify expected exceptions,
for example:</p>

<pre><code>except(TypeError, ValueError):
    pass
</code></pre>

<p>so you won't miss bugs, that you may be not aware of.</p>

python