我不明白上课是怎么用的.下面的代码在我try 使用该类时给出了一个错误.
class MyStuff:
def average(a, b, c): # Get the average of three numbers
result = a + b + c
result = result / 3
return result
# Now use the function `average` from the `MyStuff` class
print(MyStuff.average(9, 18, 27))
错误:
File "class.py", line 7, in <module>
print(MyStuff.average(9, 18, 27))
Type错误: unbound method average() must be called with MyStuff instance as first argument (got int instance instead)
发生了什么?