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
Did you save your file before running it? It might be trying to run an empty file if you forgot to save your changes.
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.
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'.
The video I watched didn’t mention saving it, and that's how it worked the first time.