Very good question - let's put it like this:Python seeks to be an elegant language. In this sense, the key words of the language are what makes it possible their mechanics: conditional with "if", "elif" and "else", loop structures with "for" and "while", definition of functions with "def" and types with "class", association of names with objects (the same effect as "attribution of values to variables") with the operator "=" and so on.These effects, having data with which to work, allow you to create any program - but understand the following: none of them "obtain" data in any form of input, nor write data for any place. These are the mechanisms of language itself. (In the version "2" of Python there was an exception that was the "print" command, a reserved word that had the side effect of placing data on the output - whether in the terminal, or in a file) - That is, all the essential "logical" of the language is in the key words (even if they don't look like key words, like the "=" operator). Now, any program, to have some effect on the environment in which it is running, needs to interact with the system somehow - whether reading and writing in files, on the screen - and it is also interesting to have other utilities such as knowing the length of sequences, creating sequences and new types - in short, things that are more or less universal tools for the program to "do something". Python's staff realized over the very evolution of the language that having these tools readily available, without having to import any library or module, it made it easy to perform complete tasks. But all these communications are made, at some level with the operating system, and can be encapsulated in a function - that for those writing a program, is identical in importance to any function that the programmer even creates. Then, these functions are always available, even if you don't mind any standard library package or module: print (in Python 3, it passes the function status), input, open to open a file, len, max, min, type, range among others. These are some of the built-in functions - and the only difference from them to any other function is that they are automatically available in any module or context. The full list of them is here: https://docs.python.org/3/library/functions.html The existence of these functions (and other variables) built-in is what makes it possible in Python, having a program that opens a file for writing and records some content in the same in a single line - whereas in Java, for example, the same operation - which is one of the most fundamental things for a program: interacting with the environment - this requires the import of two classes of distinct modules, and creating an instance of them - just to start interacting with the file -vi In Python this requires only open("meuarq.txt").write("Alô mundo!") - open is a built-in. Now, the story doesn't end there: Python has a very interesting and consistent design for function and variable names - which gives the programmer complete control of what "exists" in a given scope of the program. The complete mechanism is more or less this: when finding a function name (or another object), the Python runtime checks first if that name exists in the local variables (inside the running function, for example). If not, it searches the "global" variables - which are global in a module - in general role names and classes defined by the programmer are in this scope. If the name is not found in either of these two places, Python searchs the module __builtins__ - where all these functions are defined.This allows, for example, that for testing purposes, jokes, or even temporary modification of the behavior of a real function, you change the value of a "built-in" function simply by creating another function with the same name. The function will be created as a global or local variable, and can be used normally - until it is deleted, for example, with the "del" command - at this point, the original definition in __builtins__ it'll be used again.This allows for example to write code that works at the same time in Python 2.7 and 3.X, redefining at the beginning of the module the name "input" to be "raw_input" if we are in Python 2 - then your program can use the "input" and function normally in Python 2 - but using the modern function name already:from __future__ import print_function
import sys
if sys.version[0] < 3:
input = raw_input
Restante do programa
(As the Python 2 print is a command, the special syntax from future import print_function is required to bring print as a function, equivalent to Python 3, for a Python 2 program. But the simple assignment input = raw_input exchanges input with Python 2 "eval" by "raw_input" that always reads a string, such as input Python 3.(And yes, it is also possible to exchange the meaning of a "builtin" function by directly changing the name in builtins - this will do replacement in all program modules - but there you lose control of the situation - it is not recommended to do it)