One of the most important things to do while programming is reading source code. The primary way to do this is code walkthroughs. A code walkthrough starts at the first line, and works its way down until the program is done. While loops and if statements mean that some lines may never be run and some lines are run many times. At each line you figure out what Python has done.
Lets start with the simple perimeter program.
Don't type it in, you are going to read it, not run it. The first line is alway run first. The last item should be the right side's length, or the height. It was calculated correctly when the width and the height were equal. The next program we will do a code walkthrough for is a program that is supposed to print out 5 dots on the screen.