我已經閱讀了50篇以類似標題發佈的帖子,但還沒有回答我的問題。我的電話回到起點有什麼問題?我使用Python 2.7.7TypeError:'str'對象不能用if語句調用
def Skill():
global PSkill
global Fee
Skill = input ("Please enter your skill level - you must either enter <C> for casual or <E> for expert!!")
if Skill == "C" or Skill == "c":
PSkill = "Casual"
Fee = 30
elif Skill == "E" or Skill == "e":
PSkill = "Expert"
Fee = 45
else:
print("Sorry I don't recognise that answer - please enter the answer again")
Skill()
進一步壓低我有這段代碼時,他們是以前的錯誤,將無法正常工作。
TotalFee = float(Rate) * float(Fee)
TotalFee = str(TotalFee)
的錯誤,然後我得到的是...
Traceback (most recent call last):
line 106, in <module>
Main()
line 93, in Main
Main()
line 68, in Main
Currency()
TypeError: 'str' object is not callable
嗨,歡迎來到StackOverflow。請修復您的縮進並完整發布錯誤消息以幫助任何試圖回答您的問題的人! –
'Skill()'不是'函數'...它是一個'string'。因爲你在函數內部重用了這個名字,所以你重寫了它的名字。 – TemporalWolf
@RaminNietzsche看起來像是在python 3 –