Python – Getting Started

Python is a high-level scripting language that is easy to learn and can be used for building amazing applications. Jupyter notebook allows you to practice Python on a browser such as Chrome or Safari. Please follow the instructions to get both Python and Jupyter installed on your computer.

Windows

Installation

Python can be installed using different methods but we recommend using Anaconda.

  1. Download Anaconda (Python 3.7) directly from this link. You can find other versions here.
  2. Click on the downloaded file to install Anaconda. Click “Next” on the installation window and agree to the license agreement. Choose the default options for and finally click on the “install” button.
  3. Wait for the installation to be completed and click “Next” and “Finish” to complete.

Running Jupyter

  1. From the Windows start menu, click the Anaconda Navigator desktop app.
  2. From the Anaconda Navigator, click on the “Launch” button under the Jupyter Notebook.
  3. This will open your browser with Jupyter notebook. You will see a list of folders in the home directory. Choose a folder like “Documents” as your home directory.

If you get stuck, please refer the more detailed documentation.

MacOS

Installation

  • Download 64bit MacOS installer from this link.
  • Open the downloaded image to go through the installation process.

More detailed instructions can be found here.

Running Jupyter

  • From the MacOS Launch Pad, click on the “Anaconda Navigator”.
  • On the “Anaconda Navigator”, click on the “Launch” under the Jupyter Notebook
  • The Jupyter notebook will be automatically opened on your default browser

If you get an error on the terminal that the browser could not be opened, please run the following command from Mac terminal.

jupyter notebook --generate-config

Open ~/.jupyter/jupyter_notebook_config.py using an editor. Find #c.NotebookApp.browser = u'' and change it to #c.NotebookApp.browser = u'Chrome'.

You can also set a default directory for the Jupyter notebook by setting the c.NotebookApp.notebook_dir in the jupyter_notebook_config.py file.

Trying your first program

You are now ready to try some Python programs.

  1. Goto the Jupyter and from the top-right, click on new -> Python3 to create a new Notebook.
  2. From the top of the window, give a title to the notebook.
  3. Jupyter notebooks are arranged as cells. Type the following in the first cell. print(“Hello World”)
  4. From the menu on the top, click on the “Run” button to execute the program.
  5. You should get “Hello World” as output.

Congratulations! You’ve successfully installed Python, Jupyter Notebook, and run your first program. Happy Programming!

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *