Write your first line of Python code in 5 minutes
By: Derek Loyer
Tags: Startup, Python, Learning To Code, Entrepreneurship, Coding

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.

I 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.”

I get it, but stay with me, 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 I’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:

Click that link I posted above and find the button labeled “+ code” near the top of the page. Click it! 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. Write your first line of code. This might be intimidating and I’m giving you very little direction, but I have faith in you…and I 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 With that good-looking code in the cell, press the triangle play/run button to the left of the cell The notebook will think for a second and BOOM. Like magic, it will “print” a reply on the next line 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:

Variable assignment Math operations if/else control flow 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 able to 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.

I 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 my favorites.

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

www.nanochomp.com