Blog available for sell
This blog is available for sale. Please 'contact us' if interested.
Advertise with us
Jupyter   0   12634
How to use Jupyter Notebook for practicing python programs

What is Jupyter Notebook?

A Jupyter notebook is a web-based tool that lets us write, run and share live code, visualizations, and instructions among friends, students, and teachers. It's a powerful tool to interactively develop and present data science projects.


How to install:

Open your Linux Terminal.

Install IPython.

sudo apt-get -y install ipython ipython-notebook

Now you can install Jupyter notebook directly in the system or a better approach would be to use a virtual environment and then install it.

sudo -H pip install jupyter


Running Jupyter Notebook:

Now go to any folder where you want to save your code, and run the command to start the Jupyter Notebook.

jupyter notebook

This will start the notebook server on the localhost 8888 port. A browser window will be opened and your files in the current directory will be listed there.


Creating the first program:

Click on the 'new' button in the top right corner and select Python3. It will open a new notebook. 

Change the name of your notebook by clicking on the 'Untitled' text in the top left corner.

AYobkqU8ZfeGAAAAAElFTkSuQmCC


Now in the first blank cell, type your first python code, and hit the run button. The output will be printed at the bottom of the cell.

The cursor will move to the next cell.


PNf+V5GMCzUAAAAASUVORK5CYII=


You can always find this file in the folder you started the Jupyter notebook command. 

You have the option to download the notebook in PDF, HTML, or .ipynb format.


Uploading a file:

To use a text file in any of your programs, place the text file in the directory where you started the notebook. Alternatively, you can upload the text file using the upload button on the home screen of the Jupyter notebook.

w8LELY9gJkZ7wAAAABJRU5ErkJggg==


Here I have uploaded the 'wordcloud.txt' file using the 'upload' button in the top right corner. Now in the code example below I have used the wordcloud.txt file to open it and read its content.

NXzxICAAAiAAAiAAAiEBKJmQBD5BAARAAARAAARAAARAAATuDgEombuTV0gpCIAACIAACIAACIAACIBASABKJiSBTxAAARAAARAAARAAARAAgbtDAErm7uQVUgoCIAACIAACIAACIAACIBASgJIJSeATBEAABEAABEAABEAABEDg7hCAkrk7eYWUggAIgAAIgAAIgAAIgAAIhASgZEIS+AQBEAABEAABEAABEAABELg7BKBk7k5eIaUgAAIgAAIgAAIgAAIgAAIhASiZkAQ+QQAEQAAEQAAEQAAEQAAE7g4BKJm7k1dIKQiAAAiAAAiAAAiAAAiAQEgASiYkgU8QAAEQAAEQAAEQAAEQAIG7QwBK5u7kFVIKAiAAAiAAAiAAAiAAAiAQEoCSCUngEwRAAARAAARAAARAAARA4O4QgJK5O3mFlIIACIAACIAACIAACIAACIQEoGRCEvgEARAAARAAARAAARAAARC4OwSgZO5OXiGlIAACIAACIAACIAACIAACIQEomZAEPkEABEAABEAABEAABEAABO4OASiZu5NXSCkIgAAIgAAIgAAIgAAIgEBIAEomJIFPEAABEAABEAABEAABEACBu0MASubu5BVSCgIgAAIgAAIgAAIgAAIgEBKAkglJ4BMEQAAEQAAEQAAEQAAEQODuEPgf8gGMRdE0RicAAAAASUVORK5CYII=


You can read more about reading, writing to, copy, moving the file using python code.

Jupyter   0   12634
0 comments on 'How To Use Jupyter Notebook For Practicing Python Programs'
DigitalOcean Referral Badge

© 2024-2025 Python Circle   Contact   Sponsor   Archive   Sitemap