如何saygoodbye
编写程序,先输入两个整数,然后提示用户输入这两个整数的和。如果答案正确,程序报告结果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())
x, y = 1, 1
while x!=0 and y!=0:
stdin = input().split()
if len(stdin) == 2:
break
else:
x,y,z = map(int,stdin)
if x+y ==z:
print('true')
else:
print('false') 没有安全检查while 1:
stdin = input().split()
if stdin == '0' and stdin == '0':
break
else:
x,y,z = map(int,stdin)
if x+y ==z:
print('true')
else:
print('false') while 1:
t= input().split()
if t == '0' and t == '0' and len(t)==2:
break
else:
x,y,z = map(int,t)
if x+y ==z:
print('true')
else:
print('false')
copy楼上的,但是0 0 0不该退出 塔利班 发表于 2018-10-22 16:48
copy楼上的,但是0 0 0不该退出
是滴是滴,更严密{:5_108:}
页:
[1]