|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
temp = input("随便猜一个数字吧")
guess1 = int(temp)
if guess1 == 8:
print("你猜中了!恭喜你!")
else:
if guess1 > 8:
print("大了!!")
else:
print("小了!")
print("不玩了,游戏结束!")
TypeError Traceback (most recent call last)
Cell In[69], line 1
----> 1 temp = input("随便猜一个数字吧")
2 guess1 = int(temp)
3 if guess1 == 8:
TypeError: 'str' object is not callable
老哥,哪里出问题了?
不明白的话就把代码改成这样,执行一遍吧
- del input # 加了这一行
- temp = input("随便猜一个数字吧")
- guess1 = int(temp)
- if guess1 == 8:
- print("你猜中了!恭喜你!")
- else:
- if guess1 > 8:
- print("大了!!")
- else:
- print("小了!")
- print("不玩了,游戏结束!")
复制代码
|
|