4) Executing Python

This course provides two ways to execute Python programs. If you want, you can download and install Python on your computer (Mac, Windows, Linux). If you do this, you will typically use the IDLE editor to compose programs. You might want to check out the Beginner's Guide to Python.

For this introductory course, however, we are usually going to use an implementation of Python in the browser called Trinket.io. You can simply login with your LPS Google Apps Login - no fuss, no muss.

This will then allow you to create, save, and modify your own "Trinkets". Those Trinkets can be embedded in websites (like throughout this site) or linked to (which is how I'll have you submit assignments to me.) You won't have to install Python on your computer (although you can if you want), and you'll be able to access your programs from any computer with a web browser.

Take a look at this embedded Trinket:

Here's a simple key to help you navigate through Trinket.

Try pressing the run button in the Trinket above. You should see the two print statements appear in the execution pane. If you want to reset the execution pane, click on the Menu button, then click Reset.

Now try modifying the program shown above. Highlight the word "best" and replace it with "worst". Press run to see the new results. It's important to realize that any changes you make to the Trinket will not show to other users of the site, and will not be saved unless you make a copy for yourself and then save the changes.

Now try adding a whole new line. In the program pane, click at the end of line 2, then hit return. This should give you a third line. On that line type

print("Warriors always take care of one another.")

Now press Run.

Unsafe Scripts

We will also be utilizing Online Python Tutor to help us visualize what's going on in our programs. When this is embedded in this online text, the code will often be blocked by the browser. If you see this icon in the upper right of the address bar in chrome, you need to click on the "shield" and "load unsafe scripts" for it to display.