我想问用户2个问题。他们应该回答大于0的数字,但是如果他们回答类似1,0或者0,1这仍然是一个有效的答案。如果他们用0表示回答这两个问题,那么该程序将终止。我在哪里错了,因为我被困在这一个多小时。
a = 1
b = 1
while a > 0 and b > 0:
a = float(input("Enter A: "))
b = float(input("Enter B: "))
if a > 0 and b > 0:
#calculate equations here
#calculate equations here
#print responses here
#print responses here
elif a == 0 and b == 0:
print("Good bye!")
答案 0 :(得分:0)
如果我理解正确,我认为你要找的是
a = 1
b = 1
while a > 0 or b > 0:
a = float(input("Enter A: "))
b = float(input("Enter B: "))
if a == 0 and b == 0:
print("Good bye!")
else:
#calculate equations here
#calculate equations here
#print responses here
#print responses here