9
    balance = 100
    print('Current Balance: ', balance)
    while balance > 0:
        print('1. WITHDRAW')
        print('2. DEPOSIT')
        choice = input("Select an option... ")
        if (choice == 1):
            print('1')
        elif (choice == 2):
            print('2')
        else:
            print('test')

When I run the code with the code runner extension the code shows in the terminal however when it gets to the input function it freezes like its asking me to input some data however I cant eve type a number or letter.

This is what the terminal shows...

[Running] python -u "c:\Users\bowen\Desktop\CSE 120\PROJECT 3\main.py"
Current Balance:  100
1. WITHDRAW
2. DEPOSIT
Select an option... 
1
  • 1
    "owever when it gets to the input function it freezes like its asking me to input some data however I cant eve type a number or letter." Please be specific. Did you try clicking the terminal window and pressing either the 1 key or the 2 key? When you do so, do you see the corresponding symbol? In general, do you see a blinking cursor in that window? Are you able to make the code run properly directly from the terminal? Commented Sep 15, 2021 at 2:10

3 Answers 3

20

Code Runner shows results in OUTPUT and doesn't accept inputs by default. Add

"code-runner.runInTerminal": true

in Settings.json, then you can input data.

Sign up to request clarification or add additional context in comments.

1 Comment

How to install Python code runner in VS Code?
13

the problem is not of python but of vscode, you have to enable one setting,

  1. do ctrl+, or just open settings
  2. search for code runner run in terminal
  3. enable it

Comments

9

Step-by-step:

  1. Click on extensions and make sure Code Runner is installed.
  2. Go to File > Preferences > Settings [Ctrl + ,]
  3. Type Code Runner in the search bar
  4. Scroll down and check on Code-runner: Run In Terminal

enter image description here

1 Comment

Isn't this just a copy-paste from random_hooman's answer below? Dated from Sep 15, 2021 btw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.