5. 增加靜態方法
(1) Employee的靜態方法
以下是一個例子:
class Employee():
@staticmethod
def tax(income):
if income > 40000:
return int(income*0.23)
else:
return int(income*0.19)呼叫靜態方法:
print(f'{Employee.tax(65000):,}元')執行結果:
說明:
