Why won’t my Python code run when I hit “run code”?

0
8
Asked By CuriousCoder123 On

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?

3 Answers

Answered By NewbieNinja88 On

Did you save your file before running it? It might be trying to run an empty file if you forgot to save your changes.

CuriousCoder123 -

The video I watched didn’t mention saving it, and that's how it worked the first time.

Answered By JustStartingOut99 On

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.

Answered By TechSavvySam On

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'.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.