我一直在收到error
消息,我很難過,不知道如何解決它。TypeError:不支持的操作數類型爲*:'dict'和'浮動'
這是我寫的:
job = {'fireman': 42600, 'programmer': 48700, 'clerk': 23000}
salary = float(job * 1.05 ** years_of_service)
return salary
對於問題:
def salary(job, years_of_service):
'''(str, int) -> float
Return the salary (in dollars) of a person holding job for
years_of_service.
Each year, a person receives a 5% increase in salary over his/her previous
year. The starting salary for various jobs:
fireman $42 600
programmer $48 700
clerk $23 000
years_of_service will be at least 0.
>>> salary('clerk', 2)
25357.5
'''
'工資=浮動(工作[工作] * 1.05 ** years_of_service)由於東西' –
我收到其他錯誤消息與此: 類型錯誤:unhashable類型: '字典' 謝謝您儘管幫助! – user2425814