Python Forum
I am an absolute newbie.Help me!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I am an absolute newbie.Help me!
#1
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.
Reply
#2
it's working perfectly fine. how do you run it?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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
Reply
#4
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 ")
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#5
Yes. You are right.Awesome.My code worked. Thank you.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Absolute beginner am I missing something? kamren 7 482 Sep-25-2020, 05:32 AM
Last Post: buran
  chkFile with absolute paths JarredAwesome 7 401 Sep-21-2020, 03:51 AM
Last Post: bowlofred
  absolute imports between folders mikisDW 0 291 Aug-05-2020, 12:26 PM
Last Post: mikisDW
  Absolute newbie asking for help with blinking LEDs misterfrickel 0 651 Mar-15-2019, 08:54 AM
Last Post: misterfrickel
  Absolute Beginner Python Question matchamochi7 5 1,484 Nov-02-2018, 12:09 PM
Last Post: wookie
  Absolute Beginner to Python dthomp54 5 1,274 Oct-09-2018, 03:00 AM
Last Post: dthomp54
  Problem with absolute path to file (Mr.Stickman Problems) SheeppOSU 3 2,469 Jun-26-2018, 10:05 AM
Last Post: Larz60+
  coding error from a script (absolute noob) fuchls 2 1,955 Jun-08-2018, 02:29 PM
Last Post: webrunner1981

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020