Python Interpreters

Rabia Sajal Niazi

Writer & Blogger

a) Google Colab

Google Colab (short for Colaboratory) is a free, cloud-based Jupyter notebook environment

provided by Google. It allows you to:

  • Write and execute Python code.
  • Use GPUs/TPUs for faster computations.
  • Collaborate on projects in real time.
  • Access powerful libraries without installation.

Step 1: Access Google Colab

Sign in to Google Account: Ensure you are logged into your Google account

  1. Open Google Colab:
  2. Go to: Google Colab. Alternatively, you can access it via Google Drive:

Open Google Drive.

Click on “New” > “More” > “Google Colaboratory” to create a new notebook.

Step 2: Understand the Notebook Interface

The Google Colab interface is similar to Jupyter Notebook. Key components include:

1. Cells:

  • Code Cell: For writing and running Python code.
  • Text Cell: For writing markdown or plain text (e.g., instructions or explanations).
  • 2. Toolbar:
  • File: To create, open, save, or download notebooks.
  • Runtime: To manage the computational backend (e.g., restart runtime, select GPU).
  • Insert: To add new cells (code or text).
  • 3. Sidebar:
  • Manage files and datasets in the notebook environment.

Step 3: Create a New Notebook

1. Start a New Notebook:

  • Open Colab and click on “New Notebook”.
  • Alternatively, in Google Drive, go to “New > More > Google Colaboratory”.

2. Rename the Notebook:

  • Click on the notebook’s default name (Untitled.ipynb) in the top-left corner.
  • Provide a meaningful name for the notebook.

Step 4: Write and Run Code

1. Add a Code Cell:

  • Click on the “+ Code” button to add a new cell.

2. Write Python Code:

3. Run the Code:

  • Click the Play button on the left of the cell or press Shift + Enter.

b) Jupyter Notebooks:

Step 1: Download Anaconda

1. Visit the official Anaconda website.

2. Download the appropriate version for your operating system (Windows, macOS, or Linux).

  • Choose the Python 3.x version.

Step 2: Install Anaconda

Step 3: Launch Jupyter Notebook via Anaconda Navigator

1. Open the Anaconda Navigator (search for it in your start menu or applications folder).

2. In Anaconda Navigator, you’ll see an option for Jupyter Notebook.

3. Click the Launch button next to Jupyter Notebook. It will open in your default web browser.

 

Tweet
Share
Pin
Share
0 Shares
Scroll to Top