I kind of have an idea what to do, but I can't figure it out. The program needs to be able to get the students name and three test scores, then get the average score (percentage) out of the three scores. After that, you need to convert the score (percentage) into a grade.

_________________________________________________________________________________________________

Grading Scale:
Screen_Shot_2013-02-04_at_12.04_.32_AM_

input ('Please press "Enter" to begin')

while True:
    import math

    studentName = str(input('Enter your Name: '))
    firstScore = int(float(input('First test score: ').replace('%', '')))
    secondScore = int(float(input('Second test score: ').replace('%', '')))
    thirdScore = int(float(input('Third test score: ').replace('%', '')))
    scoreAvg = (firstScore + secondScore + thirdScore) / 3

    def grade():
        if scoreAvg >= 93 and <= 100:
            return 'A'
        if scoreAvg <= 92.9 and >= 89:
            return 'A-'
        if scoreAvg <= 88.9 and >= 87:
            return 'B+'
        if scoreAvg <= 86.9 and >= 83:
            return 'B'
        if scoreAvg <= 82.9 and >= 79:
            return 'B-'
        if scoreAvg <= 78.9 and >= 77:
            return 'C+'
        if scoreAvg <= 76.9 and >= 73:
            return 'C'
        if scoreAvg <= 72.9 and >= 69:
            return 'C-'
        if scoreAvg <= 68.9 and >= 67:
            return 'D+
        if scoreAvg <= 66.9 and >= 60:
            return 'D'
        return 'F'

    print(grade[scoreAvg])
    print(studentName, "test score is: ",scoreAvg,'%')


    endProgram = input ('Do you want to restart the program?')

    if endProgram in ('no', 'No', 'NO', 'false', 'False', 'FALSE'):
        break

Here are a few things that need to be improved in your code ...
1) don't import inside the loop or you keep on reimporting

2) don't define a function inside the loop or you keep on redefining

3) all your if statement need to be something like this
if scoreAvg <= 92.9 and scoreAvg >= 89:

4) input your numeric values with a custom function that checks the data

5) use formatted print for your result

Here is a way you could write this ...

import math

def get_num(prompt="Enter a numeric value: "):
    """
    this function will loop until a valid number is entered
    returns a floating point number
    """
    while True:
        # for Python2 use raw_input(prompt)
        value = input(prompt)
        # optional, remove possible % char
        value = value.replace('%','')
        try:
            # return breaks out of the endless while loop
            return float(value)
        except ValueError:
            print("Try again, value entered was not numeric.")

def get_grade(scoreAvg):
    if scoreAvg >= 93 and scoreAvg <= 100:
        return 'A'
    if scoreAvg <= 92.9 and scoreAvg >= 89:
        return 'A-'
    if scoreAvg <= 88.9 and scoreAvg >= 87:
        return 'B+'
    if scoreAvg <= 86.9 and scoreAvg >= 83:
        return 'B'
    if scoreAvg <= 82.9 and scoreAvg >= 79:
        return 'B-'
    if scoreAvg <= 78.9 and scoreAvg >= 77:
        return 'C+'
    if scoreAvg <= 76.9 and scoreAvg >= 73:
        return 'C'
    if scoreAvg <= 72.9 and scoreAvg >= 69:
        return 'C-'
    if scoreAvg <= 68.9 and scoreAvg >= 67:
        return 'D+'
    if scoreAvg <= 66.9 and scoreAvg >= 60:
        return 'D'
    return 'F'

#input ('Please press "Enter" to begin')

while True:

    studentName = input('Enter your Name: ')
    firstScore = get_num('First test score: ')
    secondScore = get_num('Second test score: ')
    thirdScore = get_num('Third test score: ')

    scoreAvg = (firstScore + secondScore + thirdScore) / 3

    gradeLetter = get_grade(scoreAvg)
    # use Python formatted print
    sf ="{} your test score is {:0.1f}% and your grade is {}" 
    print(sf.format(studentName, scoreAvg, gradeLetter))

    endProgram = input('Do you want to restart the program (y or n)? ').lower()

    if 'n' in endProgram:
        break
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.