Running code in Jupyter Notebook

Why doesn’t my code give me output? Feel free to tell me which Enter I need to use – I’m still confused.

Screen Link:

My Code:

def welcome(a_string):
    print('Welcome to ' + a_string + ' !')
dq = 'Dataquest'
jn = 'Jupyter Notebook'
py = 'Python'    

What I expected to happen:
Get three lines of Welcome to XX! output

What actually happened:

Replace this line with the output/error
1 Like

Make sure you run the code.

Run the code in this first cell. Insert a new cell below.

You can use Ctrl+Shift+Enter

Ctrl+Shift+Enter doesn’t result in any output for me in either command mode or edit mode.

Is your cell Code or Markdown? Make your the cell is code.

I clicked the Restore button and now it runs. Hopefully I eventually figure out how to avoid this problem!

I notice that the numbers in brackets only appear after the code has run – and I wasn’t getting those numbers until I clicked Restore. Any insight on that?

1 Like