Python 002: Software Setup
This will help you:
Install Python and a program to edit and test code.
Time: 15-30 minutes / Level: A1
You should already:
Know how to download software.
Step 1: Python, obviously.
To install Python, go to https://www.python.org/downloads/ and click the large "Download Python 3.x.x" button to download the latest version of Python. Scroll down to the table of different files at the bottom of the page. If you're using Windows, click on the link called "Windows x86-64 executable installer" (the web-based version is fine too, it will just wait to download some of the software until you actually run the installer.) Find the executable file (it'll be in Downloads or your default download folder, called something like "python-3.x.x-????.exe".) Open it.
You should see an install wizard open. On the first page, there will be a check box with the option "Add Python 3.x to PATH". * MAKE SURE THIS IS CHECKED. * If you already skipped it, you can cancel the installer or run it again - nothing bad will happen if you just run it again. Accepting the default installation configuration is fine.
You should be good after that. Startup tutorials and all the documentation for Python 3.7 can be found at https://docs.python.org/3.7/tutorial/. There are lots of ways to learn Python, but sometimes it's good to have the original documentation handy.
Step 2: Programming environments
To write and run code, you need a place to write and run code. (Microsoft Word won't cut it.) You basically have 2 options: either use an IDE (Integrated Development Environment, which lets you write AND run code in one) or use a text editor and get a little bit friendly with the command line.
If you want to just use a text editor, anything that can save .txt files will work. Notepad will get the job done, but most people needing to write more than 20 lines of code prefer to use something else. Atom is a favorite among Olin classes, but AFAIK that's just because it's pretty and has lots of add-ons.
A note on command line interfaces (CLIs) - Command Prompt in Windows uses a different set of commands from Linux CLIs. Windows Powershell is more similar to Linux. There are others you can download; those two may be pre-installed on your machine.
For IDEs, PyCharm and Visual Studio Code are good for projects and have lots of useful features. I've also seen Spyder recommended for scientific applications (data and graphs, ooOoOo). If you just want to download something and start typing and running code, try Thonny - it has a very simple interface and some small features which help new coders understand what their code is doing.
Here's a comparison of a few IDEs and text editors, which is where I got some of this from.
Once you download one of these, open it and figure out how to:
Edit - type code. Well, it's almost that simple.
Save - create a folder for your work, and ALWAYS use the .py extension.
Run - run a program either in an IDE's command pane or the command line.
Debug - read the error messages, look up problems if needed, and use the IDE's debugger if you have one.