How to use Jupyter notebook efficiently: 1.0

Muhammad Iqbal bazmi
Jul 31 · 5 min read

Let’s see the power of the Jupyter notebook…

In this blog, I am going to cover some basics of Jupyter notebook, its usage, and its power.

How to Start the Jupyter notebook?

I hope you are using Anaconda Prompt. If not, It is highly recommended to use Anaconda Distribution for the Data Science project.

Download Anaconda: Click Here

  • Open anaconda prompt
  • set the drive
  • write the command jupyter notebook
  • hit Enter

It will open a Jupyter notebook server in your default browser at localhost:8888.

Image for post
Image for post

Note: I was already using the default port localhost:8888 that is the reason It is trying to connect with another port.

Image for post
Image for post
Opened in Browser

A Jupyter notebook is an awesome tool in which you can:

  • Write code
  • Write some text
  • Add images/videos/tables
  • You can do almost everything that you do in HTML

means we can write the code and description also in the same notebook.

Let’s dive into it and create an iNTERACTIVE pyTHON nOTEbOOK(.ipynb) file.

How to create a notebook in Jupyter notebook?

  • first, click to New button
  • second, In popped option, click Python 3

It will create a new Untitled.ipynb file.

Image for post
Image for post
  • click on Untitled (underlined in the above image) to rename the notebook.
Image for post
Image for post
rename notebook
  • Click the Rename button to finalize the newly entered name.

Understanding notebook(.ipynb) file in more detail

The Notebook consists of cells that you can add or/and delete according to your need.

Each cell can be executed in two different ways(generally):

  • Markdown cell
  • Code cell

Markdown cell:

Markdown is a text-to-HTML conversion tool and simply the superset of HTML. In Markdown cell you can write your text either in HTML format or standard Markdown format.

Code cell:

In which we write our code to be executed.

Let’s see the example below…

Image for post
Image for post
Code and markdown cell

To execute any cell Hit Shift+Enter .

In the above image, M is markdown cell and not executed till now.

Just go and click on the markdown cell and execute it…

Wow! You got this result…(below)

Image for post
Image for post
  • Whenever you execute any cell, a new cell created automatically below to the executed cell. (as you can see in the above picture).

Wow, I hope you are convinced of the power of the Jupyter notebook.

Dive Deeper into the notebook

Let’s Dive Deeper into Markdown cell and How to use it?

First thing first, I hope you are familiar with HTML. If not, don’t worry we’ll not be using HTML to write our text, instead, we’ll use markdown style.


There are six types of headers that you can write using # in the markdown cell

just type # and leave a space and write whatever you want as a header.

See the example below in the image.

Image for post
Image for post
  • press Shift+Enter . you will get this result
Image for post
Image for post
header Ouput


Unordered list:

to initialize Unordered list you can use either *, +, or with trailing space.

See the below example…

Image for post
Image for post
Unordered list code

You can see in the above cell that nested elements are automatically colored differently.


Image for post
Image for post

Ordered List:

Image for post
Image for post


Image for post
Image for post
Ordered list

You can see that Jupyter notebook cares about all the nested list numbering.

Some more functionalities of the Jupyter notebook:

Image for post
Image for post
  • For Bold text, use the text enclosed with two asterisks(**), no space should be there.
  • For Italic/emphasized text, use only one asterisk(*), no space should be there.

For Block_quote/comment use > and the text further.

  • I used <hr> tag for a horizontal breaking.
  • Instead of <pre></pre> of HTML you can type a tab and trail/successor text.

The Output of above markdown command:

Image for post
Image for post

Insert Image in the Jupyter notebook:

  • Method 1: Copy any image from any source and paste the image to the markdown cell.
Image for post
Image for post
copied image
Image for post
Image for post
Resultant image
  • Method 2: Copy the link of the image from the internet source and use <img src=""> tag to showcase the image. Let’s see how?
Image for post
Image for post
Image for post
Image for post

How to play YouTube videos in the Jupyter notebook.

  • Right-click on YouTube video→Copy embedded-code.
  • In the code cell write from IPython.display import HTML.
  • use HTML(Embedded_code) , pass Embedded_code as a string.
  • run the code cell.

Let’s see how?

Image for post
Image for post

Well, suppose using all the above information you have written some notebook, right.

Now, you want to create a new notebook and want to copy the cells from the previous notebook and paste it into a newly created notebook.

Let’s see how?

How to copy and paste more than one cell into the Jupyter notebook among different notebooks?

Steps to copy more than one cell:

  • Click on the cell you want to copy from and press Esc to make the notebook in command mode. When you will press Esc, below red-highlighted pencil will disappear. The sign of a pencil means the notebook is in Edit mode.
Image for post
Image for post
  • press Shift+arrow(up/down).
  • press Ctrl+C.
  • paste it wherever you want(It is also possible for different notebook also).

There are tons of things to explore in Jupyter notebook.

Just play with all the options.

Last Suggestion:

Play with the options, you will get more…

The keyboard shortcut is very helpful to save your lot of time.

Any Query? Comment below…

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store