In Jupyter notebook you can execute only one cell at a time.
So, you have to mind code dependencies when executing cells.
For your convenience, you can use smart shortcuts to execute the current cell and select the below one: Shift+Enter.