lmoney = (input("Sounds great! How much money would you like to bet on leonardo?($1-$10,000)(Please don't enter $ sign)")
lconfirm = input('Are you sure you want to put $',lmoney, 'on Leonardo?')
每当我输入一个3位数的数字时,我都会得到一个错误,提示输入最多为1个参数,为3。是否有办法解决此问题?
最佳答案
由于输入 call 中的(逗号)而出现此错误。
Python将它们解释为的分隔符3个不同的参数。
仍然可以在输入调用中使用变量,最好的方法是
使用格式的字符串。
只需将lconfirm更改为:
lconfirm = input(f'Are you sure you want to put $ {lmoney} on Leonardo?')
关于python - 输入的错误最多为1个参数,为3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64379084/