I am having a problem getting my "break" to work correctly in this program. Can anyone help me see what I am doing wrong?

This is my program:

import string
import math
class Student:
    def __init__(self, name, hours, qpoints):
        self.name = name
        self.hours = float(hours)
        self.qpoints = float(qpoints)
    def getName(self):
        return self.name
    def getHours(self):
        return self.hours
    def getQpoints(self):
        return self.qpoints
    def gpa(self):
        return self.qpoints/self.hours
    def addGrade(self, gradePoint, credits):
        self.hours = credits
        self.qpoints = credits*gradePoint
def main():
    print "This program is a modified version of the student class. It adds"
    print "a mutator method that records a grade and calculates the GPA for"
    print "the student"
    print
    print
    grade = input("Enter gradepoint for course (Enter to quit): ")
    print
    credits = input("Enter number of credit hours for course (Enter to quit): ")
 
    stu = Student("stu", 0.0, 0.0)
    while 1:
        grade_str = raw_input("Enter next gradepoint (Enter to quit): ")
        if grade_str == "":
            break
        try:
            grade = float(grade_str)
        except ValueError:
            print "Error, use floating point number"
            return
        credits_str = raw_input("Enter next credit hours (Enter to quit): ")
        try:
            credits = float(credits_str)
        except ValueError:
            print "Error, use floating point number"
            return
        stu.addGrade(grade, credits)
 
    if stu.getHours() == 0.0 :
        print "Zero credit hours recorded"
    else:
        print "Final GPA = ", stu.gpa()
 
    if __name__ == '__main__':
        main()

This is the error:

>>> 
This program is a modified version of the student class. It adds
a mutator method that records a grade and calculates the GPA for
the student
 
Enter gradepoint for course (Enter to quit): 
Traceback (most recent call last):
  File "\\USER-7E02CF630A\My Documents\p5modstclass.py", line 77, in ?
    main()
  File "\\USER-7E02CF630A\My Documents\p5modstclass.py", line 38, in main
    grade = input("Enter gradepoint for course (Enter to quit): ")
  File "<string>", line 0
 
    ^
SyntaxError: unexpected EOF while parsing
>>>

Thanks!

this is the problem

grade = input("Enter gradepoint for course (Enter to quit): ")

input() expects a number. when you just press enter, it gives error
maybe a try:except can solve the problem...

This question has already been answered. Start a new discussion instead.