Reputation: 3375
Let's say I have a few lines I want to run one-by-one.
x=5
y=6
print(x+y)
I set the cursor on x=5
and press Shift + Enter, which according to the settings does this: Python: Run current cell and advance
However when I press shift + enter, it runs the current line, but doesn't advance it just stays there.
Any idea how to fix this?
Upvotes: 3
Views: 1584
Reputation: 142
I use the vscode-jupyter-python extension to run and advance without using code cell syntax.
Upvotes: 0
Reputation: 125
In order to "run cell and advance" as in a Jupyter Notebook, you need to first define the cells using the #%%
command.
See here: https://code.visualstudio.com/docs/python/jupyter-support-py
#%%
x = 5
#%%
y = 6
#%%
print(x+y)
Your other option is to create an actual Jupyter Notebook with the .ipynb extension. VS Code will then automatically create the cells.
Upvotes: 2