In this post, we get you started programming with Python within 5 minutes. No prior experience needed, no need to install anything on your computer. Just get started coding from your browser.
Run your first Python "Hello World" program
Where do we start? When learning a new language it is traditional to get a program to print "Hello World" (Interesting Tidbit...).
Steps
1. Head over to https://colab.research.google.com/. You will need sign-in with your Google account and after that you will see a pop-up window with all recent notebooks as shown below. Click on the NEW NOTEBOOK button.
3. Go ahead and add a few more lines. Press Shift-Enter on each line to get one more line to write your code in.
5. Finally, give a meaningful name to your work. Near the top-left click on the notebook name and change it to something meaningful.
What did we accomplish?
You were able to run your first Python program on Google's Colaboratory - a cloud-hosted Python environment with Zero Configuration. Additional points to note...
- The Notebook you created has Code cells that allow you to write program snippets and execute them. We used only single-line print() statements here. In later posts, we will move to more full-fledged blocks.
- Pressing Shift-Enter executes the code you write in the code cells. Output values if any are printed right below the cell.
- No setup was required for you, the Notebook comes ready with a virtual machine having enough RAM and CPU to execute the program
- The Notebook is automatically saved to your Google Drive. No need to explicitly save changes.
Notebook
Full code for this program is available here in the Notebook I had created for purpose of this article.





Comments
Post a Comment