python function print error message
If you indent one line by 4 spaces, but then indent the next by 3 (or 5, or 19, or ...), you'll get this error. NameError: global name '---' is not defined Python knows the purposes of certain names (such as names of built-in functions like print). Other names are defined within the program (such as variables).