I need help for this “easy” python program

Question:

I just started to learn python a couple days ago, and I started to watch some youtube videos for it. But no matter how many times I watched, I still couldn’t understand why this abomination of code is not working?

House price is $1M
If you have good credit you pay 10% for the downpayment
If not 20%

Im very new so i still dont understand stuff please critize or advice me. Thank you very much

I tried everything
If i type 100 like i did here, it’s supposed to print “you have bad credit” and “your downpayment is $200000”

Thank you guys for answering! now I can continue studying python!!

Asked By: Newbie_akee

||

Answers:

score = int(input("What is your credit?: "))

if score > 670:
    print("good credit")
    creditGood = True
else:
    print("bad credit")
    creditGood = False
Answered By: jjislam

No matter what number you wrote in the input, the line 2 if score will be True because score has a value. So line 3, 4 and 5 fill be executed but not line 7 and 8

Line 3: Your comparison isn’t assigned to anything

Answered By: gee3107

Try to use like this:

if int(score) > 670:
    print('you have goo credit')
    creditGood = True
else:
    print('you have bad credit')
    creditGood = False
Answered By: Rafaelcvo
Categories: questions Tags:
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.