Step 1: Open Terminal
We need to open terminal and “cd” into our “python_bootcamp” directory:
$ cd desktop/python_bootcamp
Step 2: Writing the Jupyter Notebook Command
Opening Jupyter Notebook through the terminal is as simple as typing the name of the tool:
$ jupyter notebook
Be sure that you are in the proper directory before typing the code; otherwise it will open wherever your terminal directory is currently located. Often, this will open Jupyter Notebook up in your user folder. Jupyter Notebook will open in your browser.
Anytime we start a new week, we’ll end up creating a new file to work from. To do so, it’s simple; just click the “New” button on the right side of the screen when Jupyter Notebook first opens. Then select “Python 3” (see Figure 1-5).
GettinG Started
Figure 1-5. Creating a Python 3 notebook
Once you click the “Python 3” option, a new tab will open as this file. Click the name at the top to rename it, and let’s name this file “Week_01” (see Figure 1-6).
Figure 1-6. Changing the file name
Jupyter Notebook Cells
Now that we’ve opened up Jupyter Notebook and created a file that we can work with, let’s talk about cells. I’m not talking about biology; rather, in this notebook you’ll notice the empty white rectangle section below the tools (see Figure 1-7). These are known as
“cells.”
Figure 1-7. Notebook cells highlighted in red
Each cell is where we can write our code, or even use the Markup language. Let’s write some markup to begin with.
Click in the first cell, so the surrounding area glows blue.
In the toolbar, you’ll notice a drop-down menu that says “code.” Click the drop-down, and select “markdown” instead.
Within the cell write the following:
# Week 01
Note When writing markup, the number of hashtags in a row relates to the size of the heading. Like htML header tags.
Let’s now run the cell to execute the code. To do this, you hold shift and press enter (the cell must be selected).
When you use shift + enter, a new cell will appear below the current one.
Within this newly created cell, let’s go ahead and write a simple line of Python to see how the output works. Let’s go ahead and write the following:
# this is python print("Hello, buddy!")
Go ahead and run the cell. It will run all the code within the cell and output the result. Again, don’t worry about the actual Python, this lesson is about how Jupyter Notebook cells run.
For the rest of this book, we’ll be writing our code inside of Jupyter Notebook files. I’ll be using markdown to specify certain sections, so be sure you’re comfortable with running cells, writing markdown, and creating a new Jupyter Notebook file before moving on.
GettinG Started
today we learned how to use Jupyter notebook and what we can do with cells. in tomorrow’s lesson, we’ll build our first python application!
Do'stlaringiz bilan baham: |