Python Forum
I am an absolute newbie.Help me! - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: I am an absolute newbie.Help me! (/thread-25786.html)



I am an absolute newbie.Help me! - feynarun - Apr-11-2020

print("If your credit score is good type G")
print("if your credit score is bad type B")
credit_score = input("Please enter your credit score now")

if credit_score in ['g','G']:
    print("Your down payment is .1 million")
elif credit_score in ['b','B']:
    print("Your down payment is .2 million")
I am trying to write a program that outputs the downpayment for a house purchase based on whether a person's credit rating is good or not. I am getting the reply "Process finished with exit code 0".Please tell me what is wrong with my code.


RE: I am an absolute newbie.Help me! - buran - Apr-11-2020

it's working perfectly fine. how do you run it?


RE: I am an absolute newbie.Help me! - feynarun - Apr-11-2020

I ran the code in Pycharm. This is the output.

Output:
If your credit score is good type G if your credit score is bad type B Please enter your credit score now B Process finished with exit code 0



RE: I am an absolute newbie.Help me! - buran - Apr-11-2020

it looks like you enter extra space, i.e. ' B', not 'B'.
You can add this space in the prompt, e.g.
credit_score = input("Please enter your credit score now ")



RE: I am an absolute newbie.Help me! - feynarun - Apr-11-2020

Yes. You are right.Awesome.My code worked. Thank you.