Please help with class.

Your first mistake is using Python 2. Second mistake is formatting.

class Employee(object):
    """Models real-life employees!"""

    def __init__(self, employee_name):
        self.employee_name = employee_name

    def calculate_wage(self, hours):
        self.hours = hours
        return hours * 20

money = Employee('Mark Kiker')
money.calculate_wage(str(40))
print money.employee_name, money.calculate_wage()

Third mistake, and the one you care about, is in line 13. You are telling the script to calculate the wage in line 12, but you never assign it to a variable or do anything with it. Then in line 13 you try to print it but you haven't entered an argument into the function money.calculate_wage().

It should be print money.employee_name, money.calculate_wage(40)

Also, don't convert the number to a string in line 12 because then the output would be:

>>> 4040404040404040404040404040404040404040

instead of 800 like you intend.

/r/learnpython Thread