And all you need is a Google Account!
So, being able to write programming code seems to be an important skill to have in the 21st century. I’m going to take you from not knowing how to program to writing some programming code in under 10 minutes, maybe. Start the clock!
What You’ll Need
- A Google Account – If you have Gmail, you have a Google Account and if you have a Google Account, you have access to Google Colab which is what we’ll be using.
- A device with a web browser – If you’re reading this, you have a device with a web browser! Using a phone can be a little creepy to type on so I’d recommend a Desktop or Laptop and this guide shows screenshots from a desktop browser. That said, all steps can and should work on your phone!
Steps to Follow
(if you see a “light” coloured version of this, don’t fear, I’m just using the dark theme 😎. All instructions will be identical)
Then click “NEW NOTEBOOK”. A new tab would have opened and you’re presented with this and a blinking cursor inviting you to type something:
In that block, type in (without the quotes) “x=1″, Press <Enter>, “y=2”, Press <Enter>, “x+y”
Now click the “Run Cell” (▸) icon (its the “play” icon in the circle to the left of the text area) and in a few moments you’ll see the following:
🎂🎉 Congratulations!! 🎉 🎂
💻 You’re now a programmer!! 💻
💸 Time to apply for some jobs 💸
This is when you exclaim, “Kavi, you’ve gotta rewind here. I have no idea what I did here and how does this even make me a programmer?”
OK OK, without going too deeply into this, let me explain.
You, using Python, just commanded a server in one of Google’s datacentres to do some basic maths.
I sense that you’re still a bit confused here. Perhaps I should just start at the beginning.
Google Colab is an online development environment hosted by Google, which uses the Python programming language. If you’re new to programming, Python is great for beginners. Also, since Google hosts it, you can write code without installing anything. Just do it all in the browser!
Now lets dig into what those instructions mean:
- x = 1
- You’re telling the machine to that there is a variable called x and you’re giving it the value of 1. From now on, when you use x anywhere, the machine will know it’s 1.
- y = 2
- You’re telling the machine to that there is a variable called y and you’re giving it the value of 2. From now on, when you use y anywhere, the machine will know it’s 2.
- You’re asking the machine to calculate x+y. It recalls that you’ve asked it to remember that x=1 and y=2. Replacing the symbols with numbers, we have 1+2
- Unsurprisingly, it returns an answer of 3.
Note that all Colabs are automatically saved and stored in your Google Drive for access. Just click on the filename (eg. Untitled0.ipynb) to change the name to something more memorable and press <Enter>. This will make it easier to find in future.
So, now that you have enough knowledge to be a little dangerous. Here’s a few more things for you to try:
- Replace x+y with x*y and run it. (* is multiplication)
- Change the values of x= and y=, run it and see the output change.
- You’ll probably want a more rigorous explanation of what programming/coding actually is. Here’s a good one.
- Do a Python for beginners course.
- Dig into all of the fun Data Science and Machine learning stuff you can do.
- Get a job.
And then after you become a super proficient expert in the domain, reach out to me and you can become my tutor! 😉
If you have any questions/would like to share your experience with learning Python, please leave a reply below. Thanks for reading!
Writing code in your phone browser, what a time to be alive.