下面是我想了解的代碼。它接收用戶輸入,我擔心的是隻有當我鍵入「否」而不是「否」時才起作用。爲什麼我不得不繼續讓我的「不」資本使我的程序在Python中工作
houseprice = int(input("please enter the house cost: $"))
while houseprice <= 0:
print("please enter a valid number try again")
houseprice = int(input("please enter the house cost: $"))
familyincome = int(input("please enter your family income: $"))
houseowened = input("have you owened a house before? ('Yes' or 'No')")
while not houseowened == 'Yes' and houseowened == 'No':
print("please enter a valid answer")
houseowened = input("have you owened a house before? ('Yes' or 'No')")
if houseprice > 500000 or familyincome > 100000 or houseowened == 'Yes':
print("eligeble")
else:
if houseowened == 'No' or familyincome < 100000 or houseprice < 500000 :
print("not eligible")
是否以滿意的方式回答您的問題?如果是這樣,請使用旁邊的複選標記標記正確的答案。這有助於社區知道問題得到了解答。 –
如果您的問題已得到解答,請使用旁邊的複選框標記正確答案。否則,我們可以做什麼來澄清? –