4. reserved words

The reserved words of a programming language are a set of words that have a special meaning and are reserved for use by the language. Each of these words has a specific purpose and cannot be used as variable names or function names.

These are the 33 reserved words in Python:

When writing code with an editor with syntax highlighting reserved words are colored to distinguish them from the rest. For example, in Python's IDLE editor, reserved words are colored orange.

integrated functions

Python has a number of functions and types built into the language that are always available without the need to import any modules.

These functions are not reserved words of the language, but we must also avoid using them as the name of our variables or functions.

When writing code with an editor with syntax highlighting the built-in functions are colored to distinguish them from the rest. For example, in the Python IDLE editor, built-in functions are colored purple.

Upper case and lower case

Words in Python are said to be Case Sensitive, which means that they are different in upper case than in lower case.

This way the word False will be different from the word false. This must be taken into account so as not to make a mistake when typing the correct word, which is False.

Avoid using this feature of Python to name two different variables with the same name, one uppercase and one lowercase. The result would be valid and they would work as two different variables, but it should not be programmed this way because it can lead to hard-to-find bugs.

variable = 3

# Esta una variable diferente
Variable = 5

# No se deben nombrar variables tan semejantes

Exercises

  1. Name four variables to contain a person's age, height, weight, and name. None of these variable names must match reserved words or built-in functions.
  2. Investigate what the following built-in functions are for: