Basic Functionality of Jupyter Notebooks
This lesson explores the basic functionality of Jupyter Notebooks. The lesson will show you how to write code in single code blocks as well as how to separate the code into multiple logical chunks. You’ll see how easy and intuitive Jupyter is to use, especially for new developers.
00:00 With our Jupyter Notebooks set up and running, let’s now take a look at the basic functionality. So now I’m here inside of this new Notebook that I just created before, and we see that there’s a code cell that’s already marked for us, and I can just click in there with my mouse and then start typing some Python code.
01:16 Jupyter already knows that this exists, so it autocompletes this for me. I can run this and get the same output that I would get when entering a variable name and pressing Enter inside of a Python interpreter.
01:26 So, this is great! What else can we see here on the site? It tells us In and the number, and this just talks about the code blocks and in which order they were run, so this was the first code block that was run. Afterwards, we ran that one, and then this one. And in case there’s some output, we also get here an Out and from which code block did it come from. Now, if I run this one again, it’s going to overwrite the number in here.
See, because it was the fourth code block that was run, now. This also means that I’m able to access the variable that I just created down here in a code block further above. So I can go back here, move that, and pass in
02:11 I get the same output because I’m using this variable that you defined further down. So you can see that everything lives inside of memory and I have the advantage of executing single code blocks to see what is the output, but at the same time, reusing everything that I create within a document in any code cell available. This is great for data exploration, where you just want to try out something, look into a table, change something, even just find out what you’re supposed to do in the process. And for this, having this incremental way of running code is great. So, you can see in here, this environment is already a great place for learning about Python programming, getting started. I’m going to remove some cells.
03:25 So, while I mentioned before that Jupyter’s great for data exploration and data analysis, I think it is also actually a great playground for getting started with programming because it is very intuitive; you have menu items that we’re going to go over in a moment; and you can try small pieces of code and see the output right away, without needing to write a long script or finding a way around in the Python interpreter or inside of a complicated IDE.
Become a Member to join the conversation.