Home > Mobile >  I need help for this “easy” python program
I need help for this “easy” python program

Time:02-02

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!!

CodePudding user response:

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

CodePudding user response:

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

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

CodePudding user response:

Try to use like this:

if int(score) > 670:
    print('you have goo credit')
    creditGood = True
else:
    print('you have bad credit')
    creditGood = False
  • Related