- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
How to run Python code on Google Colaboratory?
Google Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. It is hosted in google cloud and maintained by Google for the benefit of python coders who want to run and test python scripts using a cloud environment. In this article, we will see how to set up and run a google collaboratory cloud environment.
Opening the Python Notebook
We navigate to this google link (https://colab.research.google.com/). It opens up the below screen. We choose the option NEW PYTHON3 NOTEBOOK from the bottom right corner as shown in the diagram below.
On clicking the NEW PYTHON3 NOTEBOOK we get a new screen that allows us to write the code in python version 3 and also give a name to the file where this code is going to be stored. We can see the options to add a code cell and text cell etc, similar to the features we get in the jupyter notebooks.
Writing Python Code
Now we can write the python code in the code cell created above. We can import the require d libraries and write code to sue the libraries as we do in any normal python code.
Running the Python Code
Next, we can run the above code written by pressing the black run button mentioned in the top left corner above the code. The code runs for some time and the result is printed below as shown in the picture below.
- Related Articles
- Performing Google Search using Python code?
- Why does Python code run faster in a function?
- Why does C code run faster than Python's?
- How to run Python Program?
- How to run Gunicorn on Docker?
- How to Run a Python Program
- How to run Linux libraries on Docker on Windows?
- What does it mean to run Infrastructure as Code?
- Python script to open a Google Map location on clipboard?
- How to download Google Images using Python
- How to Block Pop-Ups on Google Chrome?
- How to run Python functions from command line?
- How to make loops run faster using Python?
- How to show current location on a google map on Android?
- Manipulate for loop to run code with specific variables only PHP?