Haiti Python Workshop/Friday

From OpenHatch wiki
Jump to navigation Jump to search

Welcome to the Friday section of the Haiti Python Workshop!

Please work through the goals on this page in order; they should take between 2 and 3 hours.

At the end, please go through the checklist at the bottom of this page, to make sure you're all set for tomorrow.

Goal #1: set up Python[edit]

This section has instructions for installing Python and running Python from a command prompt.

Goal #2: prepare a text editor[edit]

In addition to being able to run Python, we are going to install a good text editor for writing and saving Python code during the workshop.

If you would like to use a different text editor from the recommendation for your operating system, please let a staff member know.


Goal #3: practice starting and exiting Python[edit]

We'll do a lot of learning and practicing at a Python prompt (this is "interactive" because you are typing the code and hitting enter to run it yourself, instead of running it from a file). So let's practice starting and exiting Python:


Goal #4: practice navigating the computer from a command prompt[edit]

We will be running files containing Python code (Python "scripts") from the command prompt. You'll need to be able to navigate to those scripts using the command prompt so you can run them. In this section, we'll practice using these navigation commands.


Goal #5: practice running Python code from a file[edit]

Interactive Python programming at a Python prompt is great for short pieces of code and for testing ideas. For longer code, it can be easier to save the code in a file, and execute the contents of that file (aka a Python script). In this section, we'll practice running Python scripts.


Goal #6: start learning Python![edit]

It's time to start learning, reading, and writing some Python! Tonight, you'll work through a self-directed tutorial. Saturday morning, we'll have an interactive lecture to cover more Python basics.


»Click here to work through tonight's tutorial«


Goal #7: practice Python using CodingBat[edit]

Learning about functions opened up a whole new way for us to practice, using the programming site codingbat.com. The big goal of this practice section is to get you thinking about how to solve problems in Python.


» Click here to work through tonight's CodingBat questions «


You don't have to create a CodingBat account to do the exercises, but if you do create an account it'll keep track of which problems you've completed and other statistics.


Goal #8: Checkoff[edit]

To make sure that you are set up for tomorrow, please go through the following check-off steps:

  1. Start a command prompt, and from that command prompt start Python. Then quit Python.
  2. Create a new Python file (with a .py extension). In that file, type
    print "Hello World"
    

    and save the file. From a command prompt, navigate to and execute that Python script.

  3. Open your text editor, and press "Tab". Then press the left arrow key. It should only move the cursor to the left one space. This shows that you are using spaces to indent, and not tabs.
  4. Walk through the CodingBat problem that you had the most difficulty with. The Friday CodingBat questions are here.

If you have any other questions about the tutorial or CodingBat questions, now is a great time to ask!

Congratulations![edit]

You are done with the Friday portion of this Workshop.

If you have any questions, comments, or feedback on tonight's material, don't hesitate to let a staff member know.

« Back to the Workshop home page