This Looks Like a Job For... Error Man!


#1

In Python: Introduction to Classes: This Looks Like a Job For...
I successfully completed the problem. However, in the output window, it gave this message:
<bound method PartTimeEmployee.full_time_wage of >
I'm pretty sure that's not the output that was wanted, even though it told me I completed that assignment. It is because I didn't specify the hours in milton.full_time_wage, instead just writing "print milton.full_time_wage"

I don't need help with it, I just feel like this might be a problem, giving users a false-positive.


#2

If your code was written something like this:

print milton.full_time_wage

then it is asking Python to print the bound method, not the invoked return value.

To print the return value, we need to invoke the method and pass the expected number of arguments:

    def full_time_wage(self, hours):   # hours parameter
print milton.full_time_wage(24)

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.