Running python in terminal on vs code shortcut

is there a way to run python in the terminal without always using the mouse to click the “play” styled run button in the top right corner?

Screen Shot 2022-04-09 at 3.43.31 PM

If you’ve got the Jupyter extension installed (the Python extension comes with it I believe) you can define cells between pairs of #%% comment code. When your cursor is inside a cell you can use ctrl+enter to run the cell or shift+enter to run the cell and move the cursor to the following cell.

Hmm…it is installed, but ctrl + enter or shift + enter don’t do anything. It affects the terminal, but gives me a blank output each time i use the commands.

@deboer753
Install an extension called code runner

Then open the file with the python code and use the following command:
Ctrl + Alt + N

Or you can use F1 and click run…

You can use Ctrl + Alt + M to stop running.

You can also use the terminal(shortcut for starting terminal Ctrl +` ) :

Make sure to cd to the directory which has your file,then , on the terminal type:. python file.py and hit Enter

You can always use ctrl + f5 to run your Python code without debugging in your VS Code terminal.

This doesn’t need an extension and comes by default with the VS Code application