Skip to content

markchand/Python-for-Beginners

Repository files navigation

Python for Beginners, Part I: Getting Set Up

In December 2018, I started trying to understand Python. It has been--to say the least--a messy process. Here's what I learned, hopefully laid out simply enough that you can follow even if your understanding of code is basically the same as a middle schooler who hears about drugs for the first time: You're intrigued, and scared, and that cute guy/girl you have a crush on is saying that everybody is doing it.

A couple of words you need to know to get started:

This is a README file. That means "file full of text you should read before you touch anything else." Lots of projects have these. They're written by humans, and therefore of variable quality. Here are some other words you need to know:

GitHub. That's where you are now. It's Dropbox for nerds. If you look up just a little bit, you'll see that this file is inside of a repository (project) called Python-for-Beginners.

Languages. Three plus two means the same thing as 2+3, which means the same thing as "tres mas dos" in Spanish. Different languages have their strengths and weaknesses. There are a lot of computer languages out there. Two of the most popular ones right know are called R and Python. Think of them like "French" and "English." They borrow from each other, are constantly changing, sometimes the people that speak one hate the others, and sometimes people try to make them play nice. What's special about these two computer languages is that they're "open source," which means that anyone (or rather, any nerd) can help develop them, by inventing the computer version of new words and dialects.

Terminal. Terminal is a program on a Mac computer that lets you do a lot of dangerous stuff, like delete files that you shouldn't. That's called "operating from the command line" without having a software program, like this very web browser, to point and click at. In computer terms, operating on the command line instead of through a program (a graphical user interface, or GUI) means you're one step closely to communing directly with the computer in its native tongue (can you see how this gets weird?). Sometimes, people speak Python into the command line, which translates what you're trying to do into 1s and 0s. Sometimes, someone else has built a tool that makes things a little easier than that.

Jupyter notebooks. Jupypter notebooks are one of those tools that makes talking Python at your computer a little easier. It was built to speak multiple languages, like Dora the Explorer, so you can talk other languages to it, like R and Julia (Julia-Python-R...Ju-Pyt-R... Jupyter!).

Packages. In R and Python, people write chunks of code that other people can use. For example, some statistician said to themselves a long time ago, "you know what? I bet other people are going to need to do all this same statistical analysis, too. I bet it'll be hard for them to figure out, if they try it on their own. I'm a nice statistician, so I think I'll package up what I did, so that they can just type in a couple of commands and run the same analysis on their data that I ran on mine." Once they packaged up all their commands, they sent it to the (mostly volunteer) gods of R and Python, who then approved it and shared it with the rest of the world. Before that happened, R and Python could do some basic stuff. If you typed in 2+2, you'd get what you expect. But R and Python have become powerful because there are humans everywhere adding stuff to it so that our internet friends will think we are cool.

StackOverflow. In my experience, most of coding is googling. Maybe 95% googling. But random googling can get you in trouble. It's usually better to search for something on Stackoverflow, which is a trusted, if sometimes unfriendly, website where coders go hang out when they (we?) have problems.

Anaconda. I'm still figuring out what Anaconda is, but for now, here is what it does: It lets you play with Jupyter notebooks without having to go search for, and download, all those crazy useful packages other people have built. They just come all loaded up as soon as you download Anaconda.

Still with me? Great! Here are your first tasks:

Welcome back! Now, are two ways to open up a Jupyter notebook, which is what you'll code in until you're ready to play on the command line.

  1. Open the Anaconda application (On a Mac, hit ⌘+space, type Anaconda, hit Enter), then click "Launch" under the Jupyter notebook icon.
  2. Open Terminal (On a Mac, hit ⌘+space, type Terminal, hit Enter), then type the following and hit enter:
jupyter notebook

Either of these should have opened up a browser window with a list of your computer's files. Click around until you get to the spot where you want to save the new file we're about to create. I am in a file on my computer called "Python-for-Beginners," which is inside my GitHub folder. Then click on "New" in the top right-hand corner, and "Python3" to create a new Python notebook. Give it a title, wait a second, close the browser window, and look on your computer to see if there is a new file there with the extension ("that ends with") . ipynb.

You did it! Go pour yourself a drink, and then come back for Part II: A Little Bit About Machine Learning But Don?t Panic

Acknowledgments

Thanks to Karlijn Willems, Billie Thompson, Vivek Khetan and Michael Galarnyk.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published