我想要做的是將國家與前兩個國家進行比較,看看它們是否完全不同。我很難將這些值存儲在一個列表中,然後進行比較。我已經嘗試了字符串,但看起來似乎沒有正確。不支持的操作數類型爲 - :'list'和'int':如何比較列表項?
不支持的操作數類型爲 - :'list'和'int' 是我收到的錯誤。任何提示解決此問題?
def purchase(amount, day, month, country):
global history, owed, last_country
owed += amount
history += [(days_in_months(month - 1) + day)]
last_country += [country]
if history[len(history) - 2] > history[len(history) - 1]:
return str(error)
elif all_three_different(country, last_country[len(last_country)-1], last_country[len(last_country-2)]) == True:
return str(error)
else:
return True
請提供一些輸入(即列表)和預期產出 – Pynchia
而回溯,和參數的值和全局變量。我可以在那裏看到四個加法操作,並且您沒有向我們提供任何有關導致問題的信息 –
國家將作爲字符串輸入,例如「法國」 – holla