0
我已经写了一些代码:基本代码需要一个修复
mon=10
a=1
print("You have",mon,"pounds")
bet=input("How much do you want to bet?")
if bet % 1==0:
bet=int(bet)
else:
print("Give me a whole number please")
但是,当我回答,我得到:
Traceback (most recent call last):
if bet % 1==0:
TypeError: not all arguments converted during string formatting
'bet'是一个字符串,不是数字。您需要先将其转换。当你在一个字符串上使用'%'时,你正在格式化字符串,而不是得到一个数字的模。 –