edit

The basics

Before you learn to program you need some basic knowledge about your computer. I don't mean things like how the CPU communicates with the RAM or stuff like that, I mean basic knowledge about how to use your computer, how to deal with files, how to install software - what you could call computer literacy.

This is a skill that is completely independent of what programming language you might want to learn and it is very important to avoid additional frustration, when learning to program. Unfortunately this is a vast field and some of the evil details differ from operating system (regarding file names and behaviour in the shell) to operating system, but there are some fundamental things I will try to cover here.

Your computer is really dumb

The main thing to be very aware of - however obvious this might seem - is that your computer is dumb. It does not interpret what you tell it. It does everything exactly like you tell it. There is no wiggle room. You might be vaguely aware of that just by using a computer in the "normal" way, but when you are starting to write programs, you will become very aware of it. Just to get an idea, how aware you should become of it: read the chapter about lexical analysis in the Python docs. Yes, I know it's dry, but please read it. It will raise your awareness.

Details matter

Every character you type into your programs or on the commandline matters. If you are using a font, where a zero does not look significantly different from the big letter "O" or where it is easy to mix up a small "l" from a big "I" you're setting yourself up for frustration. Most monospace fonts will usually save you from that.

Even invisible things matter

The most important invisible characters are whitespace and line breaks. If you want to learn programming, you have to start understanding their meaning. So, if you don't know the difference between a tab and a space yet: now is the time to learn about it. That is one reason why you should use a decent editor or IDE to write your code. Pressing the tab key inside a good editor that knows about Python should produce four spaces instead of a real tab for example. This should also work if you have several lines marked. It should move the whole block to the right instead of deleting everything you have written and add a tab character like M$ Notepad is doing it. Notepad is the exact opposite of a decent editor. It also should work the same the other way around: pressing shift+tab should move the line or block four spaces to the left. This is called indenting and outdenting and is one really central activity in all programming tasks (not only in Python). Check out the example.

Spaces in filenames are evil

If you have not pressing reason to do otherwise, don't use spaces or any other special characters in filenames.

Python modules that should be importable mustn't contain - as this is an operator in the python syntax import my-module is therefore a syntax error.

spaces in filenames are evil

Other things you should know

  • where your files end up, if you save them
  • absolute vs relative file paths
  • installing/uninstalling software
  • know your commandline (at least a bit)