-2
我們試圖找出如何比較兩個非類型的值來找到最高得分的骰子,但是每次運行代碼時都會顯示Typeerror:unorderable types:Nonetype()> Nonetype( )返回最高的兩個NoneTypes
def compareresult():
if giveresult(dice) > giveresult(newdice):
print(giveresult(dice))
elif giveresult(newdice) > giveresult(dice):
print(giveresult(newdice))
return dice, newdice
giveresult
是:
def giveresult(tempDice):
if fiveofakind(tempDice) is True:
tempScore = int(50)
print(tempScore)
if fiveofakind(tempDice) is False:
tempScore = int(0)
print(tempScore)
你不能。您試圖將'None'與'None'進行比較,因爲'giveresult'不會返回任何其他內容。你需要修復你的'giveresult()'函數來*返回一個值。 – 2014-12-01 17:02:27
向我們展示'giveresult()'的定義。 – 2014-12-01 17:03:06
這是怎麼做到的? – BinaryBoy 2014-12-01 17:03:08