0

Iam new to python. So my code was working just fine, until I opened the same program a few hours later. The language being used is Python, in Visual code. This is a screenshot of the output terminal.

The program prompts the user to either press 'M' or 'D'at the very beginning. However, when I do so, it dosen't register. Not only 'M' or 'D', but any charater entered isn't accepted. I have code runner extension istalled. As mentioned above, the input was being accepted a few hours prior to this. I installed visual code today itself, so it is the latest version. Please help.

poiuytsa
  • 3
  • 2

2 Answers2

0

Seems more like an issue/bug in Visual code. Try to run the program externally by going to the folder, opening a console window and running it by entering python hello_world.py, then you see where the issue comes from.

Edit: I don't use Visual Code personally, but this sounds similar to your problem: How to allow VS Code to take input from users?

ewz93
  • 2,444
  • 1
  • 4
  • 12
  • I ran the code externally on the console window as you suggested and it worked! Thanks! This might seem like a stupid question, but is feasible and recommened to always use the console window externally to run code, instead of in visual studio, given the problem I am facing? – poiuytsa Mar 12 '22 at 16:38
  • For something like a hello_world program this is no problem, but probably in the long run you want to figure out this problem and get it running in Visual Studio Code. Mostly because it is just more convenient to use an IDE to handle packages, view your file structure etc. – ewz93 Mar 12 '22 at 16:45
0

It is not a python problem, maybe something with your VSCode or its extension, or your computer. Try to do the next steps:

  1. Reboot PC
  2. Restart VSCode
  3. Reinstall VSCode
  4. Try to use Shell, there is an example
  5. Try another PC
  6. Try an online python console like this one
  7. Install Linux instead of Windows

and so on.

Bauyrzhan Ospan
  • 300
  • 2
  • 4