 As I was grading the first assignment, I saw some style problems that kept coming up over and over again. I'd like to discuss how to solve those style problems, and I'll use the context of this sample assignment. It's an assignment where the student has to write a program that asks users for the width and height of a rectangle, and then calculates and prints the area of the rectangle. Here's a program that does the job, but it has a lot of style issues. Let's run the program first to make sure that it works. If I have a rectangle that's 4.5 by 4, the area is 18, so there's nothing wrong with the calculations. Let's solve some of the style issues. First, the comment at the beginning of the program should describe the program well enough so that someone who hasn't read the assignment will know what the program is supposed to do. Using variables isn't specific enough. That could be anything. Where do you get a good description of what the program does? You get it from the assignment. The assignment has to describe the purpose of the program. Let's copy this description and paste it in here, and then edit it. Instead of writing a program named, we'll say this program asks the user for the width and height. This line's a little bit long, so let me split it into two separate lines for readability. It's a comment, so our program is still going to work fine. And let's go on to some of the other style issues. First, we have this capital W on width and capital H. By convention, Python variable names begin with a lowercase letter. I'm going to change it here and here as well. What do I mean when I say by convention? By convention means it's an unwritten rule when that everyone's expected to follow. You don't have to follow it, but if you don't, people will look at you funny. Now that we're following the convention, we still have a working program, mind you. Let's go on to some of the other issues, and the big issue here is spacing. We have a block of text here that's really dense. It's hard to read. One of our style guidelines says that you have to put a space on both sides of arithmetic operators, and that includes the assignment operator. I'll put extra spaces here and also after the commas. Notice that this has opened up our code a little bit already. And again, the code still runs fine. One other issue that I've seen is overuse of float. We converted our input string to float and stored it in the width. And we did something similar. When we took the string input for the height, converted it to float and stored it in the height. These are already float. We don't need to convert them to float again. Let's get rid of this unnecessary call to float here, and also this unnecessary call to float. The program's still going to work fine. In addition to the horizontal space that we added on both sides of the arithmetic operators, it's often good to put in vertical space to increase readability of your code. I'll put a blank line here, another one after my input, and another one after my calculation. Now the code is grouped. The input is altogether the calculation, and in most programs that will be more than one line. And my output, which again is usually more than one line. Adding these extra blank lines gives me a grouping effect, and it's opened up the code considerably and made it a lot more readable. And it still runs great. Have you noticed that the input cursor is right up at the end of the words? And that's a little bit ugly. We'd like to give the user some breathing room also in terms of space. The way we can do that is by putting a colon and a blank before the closing quote. Now, when someone runs our program, there's a little bit of extra room and the cursor's not right up against the prompt. Those are some of the style issues that come up in beginning programs. The best way to avoid them is to not have them in the first place. Remember to put in good comments, do the correct spacing, and follow conventions for variable names as you are typing your program so that you don't have to come back and fix all of that later.