I would like to be able to run an indented block of code in python in the same way I do in R. In particular, if in RStudio I have the following indented block of code:
print(seq(from = 1,
to = 10,
by = 1))
I can place the cursor everywhere (at the beginning of the code, in the middle, at the end) except in a new line below and simply press Cmd+Enter (or Ctrl+Enter) and I can run such code.
However, in Spyder 4.2, a similar code like this one:
import pandas as pd
cars = {'Brand': ['Honda', 'Ford','Audi'],
'Price': [20000, 30000, 40000]}
will not run wherever I place the cursor, and I have to select the two lines to create the dataframe and launch the whole selection with Cmd+Enter (I modified the keyboard shortcuts in the preferences of Spyder to run a selection).
Any advice on how to run such code without selecting it first? Thanks!