|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
temp=input
guess=int(temp)
if guess == 8:
print("你猜对了")
else:
print("你猜错了")
print("游戏结束")
这是错误原因
Traceback (most recent call last):
File "D:/python/1.py", line 2, in <module>
guess=int(temp)
TypeError: int() argument must be a string, a bytes-like object or a number, not 'builtin_function_or_method'
本帖最后由 青出于蓝 于 2021-7-23 14:53 编辑
- temp=input()
- guess=int(temp)
- if guess == 8:
- print("你猜对了")
- else:
- print("你猜错了")
- print("游戏结束")
复制代码
input后面要加括号,括号里面可以添加字符串
|
|