Google Colab
Google Colab
Step 1 − Open the following URL in your browser − https://colab.research.google.com Your browser
would display the following screen (assuming that you are logged into your Google Drive) −
Step 2 − Click on the NEW NOTEBOOK link at the bottom of the screen. A new notebook would open up as
shown in the screen below.
As you might have noticed, the notebook interface is quite similar to the one provided in Jupyter.
There is a code window in which you would enter your Python code.
Setting Notebook Name
By default, the notebook uses the naming convention UntitledXX.ipynb. To rename the notebook,
click on this name and type in the desired name in the edit box as shown here −
We will call this notebook as MyFirstColabNotebook. So type in this name in the edit box and hit
ENTER. The notebook will acquire the name that you have given now.
Entering and Executing Code
You will now enter a trivial Python code in the code window and execute it.
To execute the code, click on the arrow on the left side of the code window.
Adding Code Cells
To add more code to your notebook, select the following menu options −
Alternatively, just hover the mouse at the bottom center of the Code cell. When the CODE and TEXT buttons
appear, click on the CODE to add a new cell. This is shown in the screenshot below −
Run All
To run the entire code in your notebook without an interruption, execute the following menu options −
Runtime / Reset and run all…
It will give you the output as shown below −
Changing Cell Order
When your notebook contains a large number of code cells, you may come across situations where
you would like to change the order of execution of these cells. You can do so by selecting the cell that
you want to move and clicking the UP CELL or DOWN CELL buttons shown in the following
screenshot −
Deleting Cell
During the development of your project, you may have introduced a few now-unwanted
cells in your notebook. You can remove such cells from your project easily with a single
click. Click on the vertical-dotted icon at the top right corner of your code cell.