|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
编写程序,先输入两个整数,然后提示用户输入这两个整数的和。如果答案正确,程序报告结果true;
否则,报告false。 输入两个加数,一个结果,直到输入两个0为止 。
Sample Input
20 5 100
15 5 50
17 27 44
0 0
Sample Output
false
false
true
红色字体是我的问题——下面时我打的代码,就差那个了!!!
x,y,z = map(int,input().split())
while x!=0 and y!=0:
if x+y ==z:
print('true')
x,y,z = map(int,input().split())
else:
print('false')
x,y,z = map(int,input().split())
没有安全检查 - while 1:
- stdin = input().split()
- if stdin[0] == '0' and stdin[1] == '0':
- break
- else:
- x,y,z = map(int,stdin)
- if x+y ==z:
- print('true')
- else:
- print('false')
复制代码
|
|