Why won't my Python code run when I hit "run code"?
Asked by
CuriousCoder123
I'm brand new to programming and just started learning Python about 10 minutes ago. I followed one video to install Python, but it was for a different laptop than mine, so I'm unsure if everything's set up right. I was able to run a simple code, like "print('hello world')" at first. However, after trying to follow another video, I seem to have made changes I don't understand. Now, when I open the Python extension, select Python as my language, and type "print('hello world')", pressing "run code" doesn't execute anything, and there are no error messages. What's going wrong? How can I fix it?
Answers
If saving doesn't help, you can try running your code from the command line. Open a terminal (like CMD or bash), navigate to where your Python file is saved, and run it using a command like 'python filename.py'.
Reply to this answer
Sometimes you need to click 'run code' a little more firmly. It sounds silly, but it might just be a glitch with the button or your editor.
Reply to this answer
Did you save your file before running it? It might be trying to run an empty file if you forgot to save your changes.
Reply to this answer
Add your answer
Answers are reviewed before publication.
CuriousCoder123: The video I watched didnโt mention saving it, and that's how it worked the first time.