A.4 Type Errors

You have tried to do something to a variable of the wrong type. There are many forms:

TypeError: illegal argument type for built-in operation
You asked Python to do a built-in operation on the wrong type of variable. For example, you tried to add a number to a string.

TypeError: not enough arguments; expected 1, got 0
You used a function without supplying the correct number of parameters.

TypeError: unsubscriptable object
You tried to reference a variable that did not have more than one element (e.g. a float or integer) by offset:

  >>> x = 5
  >>> print x[0]