Introduction: Our first programs 🐣

The wait is over! Week 0 was about preparing for the course, and Week 1 was about course information and the "Big Picture", but starting now we focus on writing programs.

The goals for the week are for you to become comfortable writing SIPO style programs using Python, and to get some practice in moving from a problem described in English, through a solution procedure described using English to one expressed in Python.

This week we'll move on and begin writing short programs to calculate things. These programs sometimes go by the acronym SIPO to remind us of the operations they use: Sequence, Input, Processing and Output. They are just like sequences of calculator commands placed one after another.

This week we will put the first four (of six) computational constructs to work to write SIPO programs. These are calculator-style programs that use a sequence (S) of instructions to take some data (input or I), process it (P), and display the result (output or O). I say "calculator-style" because the problems are ones people often use calculators for.

While the programs themselves are quite short, they will introduce you to the need to keep three separate things in mind as you program:

  1. The program code
  2. What is going on in the computer's memory
  3. What is displayed on the screen

One of the first challenges in learning to program is to develop the ability to keep all three things in mind as you develop your program.

There are also several points of programming craft that come up for the first, but definitely not the last, time this week, including choosing good variable names, program layout, documentation, and using symbolic constants.

And one arithmetic operator that is very useful in a wide variety of programs, but may be new to you: modulo.

Assignment 1 was somewhat artificial, because I needed a way to know that you had read the things I'd asked you to, and that you had installed Python, but the remaining assignments are more authentic. They will usually ask you to write around 4 small programs, though our idea of what "small" is will grow as the course progresses!

The remaining assignments are more homogeneous than the first one. There won't be more short answer questions, cards to sort, or sculptures to describe, just programs to write from here almost to the end of the course. Four programs most weeks.

  1. Recall: Programming is...
  2. The Problem
  3. Do The Problem By Hand
  4. Translate the Algorithm into Python
  5. Enter, run and test the program
  6. Naming Values
  7. What will it look like onscreen?
  8. Documentation
  9. Our second program (Same as the first only backwards) html#translate-to-python)
  10. Our third program (dhms2s.py)
  11. SIPO Summary
  12. Translate into Python
  13. Modulo: A Sixth Arithmetic Operator
  14. Symbolic Constants
  15. Intermission: Summary (so far)
  16. Object Types 1: ints and floats
  17. Example: Calculating Tree Radius
  18. Example: Value of your change
  19. Example: Making change
  20. Pythonic Details
  21. Triple Quoted Strings
  22. The Continuation Character
  23. The done trick
  24. Output Formatting
  25. The Pythonic Process
  26. Exercise sheet 1
  27. Assignment 2