我想要做的是将国家与前两个国家进行比较,看看它们是否完全不同。我很难将这些值存储在一个列表中,然后进行比较。我已经尝试了字符串,但看起来似乎没有正确。不支持的操作数类型为 - :'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