class Employee :
raisepercent = 1.04
def __init__(self,firstname,lastname,pay) :
self.firstname = firstname
self.lastname = lastname
self.pay = pay
self.email = firstname + '.' + lastname + '@gmail.com'
def fullname(self) :
return self.firstname + ' ' + self.lastname
def payraise(self) :
self.pay = int(self.pay * raisepercent)
@classmethod
def parse_string(cls,emp) :
firstname, lastname, pay = emp.split('-')
return cls(firstname, lastname, int(pay)
emp_1 = Employee.parse_string('John-Doe-70000')
print emp_1.__dict__
print emp_1.fullname()
print emp_1.email
print emp_1.pay
emp_1.payraise()
print emp_1.pay
When I try to run the code, I get this error :
emp_1 = Employee.parse_string('John-Doe-70000')
^
SyntaxError : Invalid syntax
If I delete this line, the error comes in the next line that comes after the class. I've written nonsense code above the class and in the class but it still ignores any error and will mark the first word below the class as an error.Any Solutions? My python interpreter/executor/whatnot works fine with other code