任何人都可以告诉我为什么这总是回归'没有抵押贷款&#39 ;?
job = input('do you have a job?, Y or N ')
wage = int(input('how much do you earn a year? '))
if job == 'Y' and wage<20000 :
print ('you can have a mortgage')
else:
print('no mortgage')
答案 0 :(得分:-1)
如果用户输入的是小写,则会返回'no mortage'。要确保用户的输入始终为大写,请使用
if job.upper() == 'Y'