Jupyter; wrong execution order?


Following the instuctions in the lecture notes, I just installed Python 3.6 using the Anaconda 5.0.1 for Windows installer (64 bit) and am using the jupyter notebook for some beginner programming exercises:

print('What is your name?')
name = input()

This doesn’t produce the output I am told to expect: it gives the box for input before printing the question:

As you might have guessed, I am a total beginner. What am I doing wrong?


Hi there,

Is this example something you’ve found elsewhere?

I think that may just be the default placement of the textbox. You’ll see once you enter some output, it will be printed below the question. In any case, I think the best use of Jupyter would be to have a Markdown cell above with the question.



This is because of the Jupyter environment.

You could use input like this:

name = input("What is your name? ")

which would put the box next to your question (but still at the top) as the cell waits for input. Once the input has been entered the correct order should be displayed.


Thank you for the answers; I was just plating around a bit, and this stuck me as unusual.