Does my function right on python?
- by Ali Ismayilov
Write a function which takes a string argument, and creates and returns an Employee object containing details of the employee specified by the string. The string should be assumed to have the format
12345 25000 Consultant Bart Simpson
The first three items in the line will be the payroll number, salary and job title and the rest of the line will be the name. There will be no spaces in the job title but there may be one or more spaces in the name.
My function:
def __str__(self):
return format(self.payroll, "d") + format(self.salary, "d") + ' ' \
+ self.jobtitle + self.name