This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

I just want something to happen....


In the example here, I am doing the “Hello World” thing, because the other programmers might not play with me if I don’t. Don’t ask. Also, in python any reference to Monty Python is strongly encouraged.  So instead of “Hello World!” I am demonstrating “Bloody Romans!”

You try it. In the left, white, window type:

print ‘whatever’

Did you put something interesting in there besides “whatever”? If you noticed, python handles double quotes and single quotes in a very cool way. Try the following  lines and see if you can notice something cool:

Cool, huh? Python is smart.

Now try removing the octothorpe from the last line like this:

 If you got an error on the last line it’s because the single or double quotes need to match. If you didn’t get an error on the last line then you did something wrong.

So fix it and run it again, change the double quotes to a single quotes:

You could have changed the single quote to a double and it would have worked as well. But you also learned something new in python without even knowing it: commenting. The octothorpe, “#”, is for commenting. If you noticed in the above example, the fifth line never printed, but the sixth line did.

In programming the octothorpe is like the word “goose-fabra”. If you get frustrated with your work, stop and repeat “octothorpe” over and over until you’re relaxed. Try it, it works. When talking to others you can just say “pound-sign” or something.

Task Discussion