Write your first line of code in 5 minutes

A lot of our projects start in Jupyter notebooks. And by a lot I actually mean all. 

For the non-nerds reading this thinking, “What is a Jupyter notebook? Why do I care? Where are you going with this?” I’ll get to all of those burning questions soon, but first, a challenge. 

This challenge is for anyone who hasn’t tried to code, who has wanted to learn but was intimidated, anyone who hasn’t written a line of code in a long time: we challenge you to write seven lines of code today. Right now, even. 

We can hear the excuses already.

“Meh. That sounds complicated.” 

“I really don’t have time. Maybe later, though.” 

“You really expect me to install all that stuff on my computer? I don’t even have admin rights to this computer. How would I possibly install Python let alone try to learn to code. I have spreadsheets to get to. Bye!”

“Barstool just went live on Instagram; I’ll do it later.”

We get it, but stay with us, because with Python and Jupyter notebooks zero of those excuses are valid. With tools like Google Colabratory, you don’t have to install anything on your computer since it’s cloud-based and accessed through your browser, including the one on your phone. Writing your first lines of Python code isn’t even going to be difficult; it will be slightly easier than replying to that last email you opened and about as time consuming and complicated as sending a tweet.


Now that we’ve eviscerated those excuses of yours, let’s get started.


Clicking here will take you to your first notebook, complete with a “getting started” guide. You can read all of that beautiful prose later because the goal is to get you to write your first lines of Python right now. So, with that in mind:

  1. Find the button labeled “+ code” near the top of the page. Click it! 

  2. A code cell will pop up with your cursor in it, blinking at you, almost daring you to start writing your first line of code (if Goosebumps were written today one would start like this)

  3. Write your first line of code. This might be intimidating and we’re giving you very little direction, but we have faith in you...and we even made a cheat sheet for you to look at (heck, copy and paste into your notebook to prove it works). Spaces and tabs matter in Python so mind those tabs in the example with the “if/else” statements

  4. With that good-looking code in the cell, press the triangle play button to the left of the cell

  5. The notebook will think for a second and BOOM. Like magic, it will “print” a reply on the next line

  6. Want some extra credit? Of course you do. Change the numbers for ‘a’ and ‘b’ and press the run button again to see the output change.

That’s it. Congratulations, you did it. You wrote your first Python program. 

To recap, you made a simple adder and comparison tool. You learned:

  1. Variable assignment

  2. Math operations

  3. if/else control flow

  4. Printing a result

While it’s not the cutting edge machine learning and AI tool that you are going to blow the Valley’s mind with, you still overcame a barrier.  You learned that writing code was actually no big deal. 

So, don’t stop now. 

Keep learning, because the more basic computer science you know the better you’ll be at not only identifying problems and places to optimize your business, but also identifying solutions, even if you’re not the one who’s writing the code. Just wait until you start connecting the dots and realizing what you can do with Python and all of your data.
Wanna take a deeper dive into Jupyter and install it on your computer? Check here.

We recommend using Anaconda for your Python installation because it’s easy, effective, and comes with Jupyter built in. 


Don’t love Google Colabratory and want to try Jupyter’s online environment? Here you go


Already hooked and want to take a Python bootcamp? This online course from Jose Portilla is one of our favorites.


Did you complete the challenge? Did you do it from your phone? Feel like diving deeper? Let us know. 


Have a great holiday season, let’s gear up for a great 2021.

Previous
Previous

Data-driven gone wrong: when single metrics breed unintended consequences

Next
Next

Startup Bootcamp, Part 15: Building a Wizard of Oz MVP