I have always been meaning to flush out this Python tutorial, so here it is. It’ll be really easy, designed for someone who doesn’t know any programming. Also, it shouldn’t take more than about 5 minutes for each lesson! I don’t like long intros, so let’s start!
First, some ground rules.
- Type things yourself – Don’t just copy what I type and paste it into your own window. You won’t learn anything that way. They’ll be short, I promise.
- Ask questions – Please. Let me know if you don’t understand something. I’ll probably miss something that I take for granted but probably looks like voodoo to others. It’s not magic, I promise.
Have fun – Programming is fun when you get the hang of it. I won’t post anything that I won’t laugh at myself*, I promise.
*and trust me, I laugh at myself all the time.
First things first: Go to http://www.python.org/download.
If you’re on Windows, download Python 3.3 Windows X86 MSI Installer. (We’re installing the 32-bit because there are a few libraries that do not support 64-bit.) Double click on the install file and use the default for everything (keep hitting Next, OK and Finish until the box goes away).
If you’re on a Mac, download the Python 3.3 Installer based on if you have a Puma or a Tabby. Double click (or whatever Mac people do) on the install file and use the default for everything.
If you’re on Linux, and you don’t know how to download Python, you need to set down your older sibling’s computer and go shout profanities on Modern Duty 2 (or whatever you kids play now-a-days). But if you’re insistent, it’s probably something like
apt-get install python.
PyCharm is a piece of software called an Integrated Development Environment or IDE. That’s fancy speak for “a feature-rich program to write code.” This step isn’t necessary, but is strongly suggested. Please download their Community Edition (it’s free). It will take us a minute to set up, but it will be worth it!
- After you install PyCharm and you get to the first configure window, choose whatever color scheme you like. (I like Darcula!)
On the Welcome screen, choose “Configure”, then “Settings”.
Find “Python Interpreter>Python Interpreters” on the left, then click the “+” on the right. Choose your Python 3.3 install listed, then click “OK” to go back to the Welcome screen.
Click “Create New Project” and name it something like “super_simple_tutorial”.
Finally, go to “Tools>Run Python Console…” on the menu bar.
This Python Console window will be your primary tool through most of the lessons. It will evaluate what you type on the line after the “>>>” and print it back to you below it. For example, type
print("hello world") after the “>>>” and you will get something like this:
>>> print("hello world") hello world
Congratulations! You can now program!