- 帖子
- 11
- 精华
- 0
- 积分
- 46
- 阅读权限
- 10
- 注册时间
- 2018-9-17
- 最后登录
- 2018-10-23
|
num = 10
print('Guess what I think?')
answer = int(input())
if(answer < num):
result = answer < num
print('too small?')
print(result)
elif(answer > num):
result = answer > num
print('too big?')
print(result)
elif(answer == num):
result = answer == num
print('equal?')
print(result)
我用的是py3的呀,为什么输入字母还是报错呢?不是已经强转了int类型了吗?我带上引号也不好用呢?求大神们解答,跪求跪求哈
C:\Users\p_zduan\PycharmProjects\untitled\venv\Scripts\python.exe C:/Users/p_zduan/PycharmProjects/untitled/newtest02.py
Guess what I think?
i
Traceback (most recent call last):
File "C:/Users/p_zduan/PycharmProjects/untitled/newtest02.py", line 3, in <module>
answer = int(input())
ValueError: invalid literal for int() with base 10: 'i'
Process finished with exit code 1
|
|