I am learning python. And I created a simple application related to loans. The problem statement is like this.
If the applicant has a high income and good credit, he/she is eligible for a loan. Else not. Here is the code
has_high_income = input("Is your income high (Y/N): ")
has_good_credit = input("Is your good credit (Y/N): ")
if has_high_income and has_good_credit == "Y":
print("Eligible for the loan")
else:
print("Not eligible for a loan")
If I do Y in both cases then it will show me Eligible for the loan which is correct. If I do 1st Y and the second N then it shows me Not eligible for a loan which is also correct but when I do 1st N and 2nd Y it shows me Eligible for the loan which should be not correct. Please tell me what I have done wrong in my code. I will be very happy if you will solve my problem!!