Boris Paskhaver

Python is one of the world’s most popular programming languages. A variety of technical domains make use of it, including web development, data science, natural language processing, and machine learning. The reasons for its growth are easy to understand. The language has the perfect balance between power and productivity. Python enables you to build complex, real-world software applications with a terse syntax renowned for its elegance and simplicity. Developers can accomplish a lot with a little code in Python.

If you’re learning Python for the first time, you might be curious about the best text editor or environment in which to learn the language. In this article, we’ll explore why Jupyter Notebooks are a great option for new and experienced developers alike. The Notebook’s design encourages active experimentation by showing you the results of your code immediately. Read on to find out how to get started with this popular technology.

Data Analysis with Pandas and Python

Last Updated November 2023

Bestseller
  • 141 lectures
  • All Levels
4.7 (22,826)

Analyze data quickly and easily with Python’s powerful pandas library! All datasets included — beginners welcome! | By Boris Paskhaver

Explore Course

What is a Jupyter Notebook?

Jupyter Notebook is a development environment for writing and executing Python code. The non-profit, open-source Project Jupyter organization maintains the software. It comprises a sequence of cells, each containing a small code sample or documentation in Markdown. Developers can execute a cell and see its output immediately below the code. The ingenious design creates an instant feedback loop, allowing the programmer to run their code and change it accordingly.

Jupyter Notebook cells also support annotations, audio files, videos, images, interactive diagrams, and more. This is another major benefit of the software; you can tell a story with your code. Readers can see the steps you followed to get to your result.

You can import Python packages like pandas, NumPy, or TensorFlow directly into the Notebook. The figure below shows an example of the pandas data analysis library executing in Jupyter.

Table, pandas data analysis library executing in Jupyter

How do I get started with Jupyter Notebooks?

The easiest way to get started with Jupyter Notebook is by installing Anaconda. Anaconda is a Python distribution, a bundle of related software. Anaconda installs Jupyter alongside 100+ Python libraries for data analysis, statistics, visualization, and more. You can set everything up with a single installer.

Anaconda is available for Windows, macOS, and Linux machines. Installation is simple. Head to https://www.anaconda.com/products/individual and locate the Graphical Installer for your operating system. Follow the instructions to set up the application on your computer.

Anaconda pre-installs several popular development environments for Python. Once the installation completes, launch the Anaconda Navigator application. From its primary screen, you’ll be able to launch any of these coding environments.

Graphical user interface, application, Anaconda navigator

Click on Jupyter Notebook to run the notebook. The application will launch in your default web browser.

Graphical user interface, application, Jupyter notebook

The Notebook interface is essentially a file navigator. It is like the Finder app on macOS or the Windows Explorer app on Windows. You can traverse the folders on the computer to your work directory, then create or open a Jupyter Notebook file. 

open a Jupyter Notebook file

To create a new Notebook, click the New button on the right-hand side of the screen. Select Python 3 from the drop-down list; Jupyter will create a Python notebook. Jupyter Notebook files have a .ipynb extension.

Jupyter notebook, New button, Python 3

The Notebook displays its title at the top; it is currently “Untitled.” Click the title, and a modal will appear where you can give the notebook a custom name.

What can I do in a Jupyter Notebook?

A Jupyter Notebook consists of cells. There are two primary cell types:

Markdown is a formatting language that uses symbols to denote elements like headers, lists, and blockquotes. For example, the # symbol before a piece of text creates a heading. You can use Markdown to provide descriptions, annotations, metadata, or anything that will help a reader understand your work.

When you click into a cell, you can choose its type from a drop-down menu on the top toolbar.

jupyter notebook markdown, drop-down menu on the top toolbar

Jupyter Notebook operates in two modes: Edit Mode and Command Mode

Activate Edit Mode by clicking into any cell. In this mode, the Notebook interprets our keystrokes literally. We can use our keyboard to enter text into a cell.

Let’s execute some sample Python code. You should see a single cell in your newly created Notebook. Click into it and enter a basic mathematical expression like 1 + 1.

cell in notebook, 1+1

Python has not processed our code yet. With your cursor inside the cell, press Shift + Enter to execute the cell. Jupyter will output the result of the evaluation below. It will also create a new cell directly below the executed one.

Jupyter output, new cell

Notice the [1] to the left of the cell. The number reflects the cell execution order relative to the start of the Notebook. We can execute cells in any order, and we can execute any cell multiple times. The number in square brackets will update accordingly.

We can immediately see the benefits of this trial-and-error approach to development. There is no need to save and re-save files or run Python from the Terminal. The Notebook gives us instantaneous feedback. We observe the results we get and change our code accordingly.

Press the Escape key to enter the Notebook’s second mode, Command Mode. Think of this as a “navigator mode” where you perform Notebook-level operations. In Command Mode, you can create cells, copy and paste cells, delete cells, etc.

The Notebook includes several helpful keyboard shortcuts in Command Mode to reduce notebook clicks. Some of my favorites include:

You can access more advanced options on the top-level navigation menu. It includes options for copying and pasting cells, exporting the Notebook to various types (PDF, HTML, etc.), altering cell presentation, and more.

If the notebook ever becomes unresponsive, the Kernel > Restart command on the top-level navigation menu restarts the kernel. The kernel is the “listener” that is processing and responding to our cell executions. Restarting the kernel is equivalent to closing and relaunching the Jupyter Notebook.

Once you’re done for the day, save the Notebook (Ctrl + S on Windows, Cmd + S on a Mac), close the browser, and shut down Anaconda Navigator. This ends the running Jupyter process.

Summary: Where do I go from here?

As you can see, Anaconda + Jupyter Notebook offers a powerful and easy way to get started with Python. 

With Jupyter, you can write your Python code and see its results instantaneously. You can couple the code with Markdown cells to leave additional comments and documentation for your work. I like to use Markdown for notes, links, explanations, even jokes that help my understanding the next time I read the code. Jupyter was a big factor in helping reduce friction when I was first learning the Python programming language.

Many Python courses on Udemy use the Jupyter Notebook environment. I hope it proves helpful in your future studies!

Page Last Updated: November 2021

Top courses in Python

Python for Beginners
Navin Reddy
4.6 (9,465)
Python for Beginners (2023)
AlgoSTEM Inc.
4.5 (3,112)
Python 3: Deep Dive (Part 1 - Functional)
Dr. Fred Baptiste
4.8 (11,682)
Python for Data Analysis & Visualization
Malvik Vaghadia, Pathfinder Analytics
4.6 (1,632)
100 Days of Code: The Complete Python Pro Bootcamp
Dr. Angela Yu, Developer and Lead Instructor
4.7 (322,255)
Bestseller
Learn Python & Ethical Hacking From Scratch
Zaid Sabih, z Security
4.7 (19,797)
Artificial Intelligence: Reinforcement Learning in Python
Lazy Programmer Team, Lazy Programmer Inc.
4.8 (10,224)
Bestseller
Learn Python Programming Masterclass
Tim Buchalka, Jean-Paul Roberts, Tim Buchalka's Learn Programming Academy
4.6 (102,988)
REST APIs with Flask and Python in 2024
Jose Salvatierra, Teclado by Jose Salvatierra
4.6 (23,070)
Bestseller

More Python Courses

Python students also learn

Empower your team. Lead the industry.

Get a subscription to a library of online courses and digital learning tools for your organization with Udemy Business.

Request a demo

Courses by Boris Paskhaver

Data Analysis with Pandas and Python
Boris Paskhaver
4.7 (22,821)
Bestseller
Learn to Code with Ruby
Boris Paskhaver
4.7 (6,134)
Bestseller
Learn to Code with Python
Boris Paskhaver
4.6 (5,592)
Testing Ruby with RSpec: The Complete Guide
Boris Paskhaver
4.6 (1,933)
Bestseller
Getting Started with React Hooks
Boris Paskhaver
4.6 (975)
Vue Masterclass (Covers Vue 2 and 3)
Boris Paskhaver
4.4 (950)

Courses by Boris Paskhaver