´Indice general
1. Introducci´on1
1.1. Computadores. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2. Programas y lenguajes de programaci´on. . . . . . . . . . . . . . . . . . . . . . . . . 21.2.1. C´odigo de m´aquina. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2.2. Lenguaje ensamblador. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.2.3. ¿Un programa diferente para cada ordenador?. . . . . . . . . . . . . . . . . . 51.2.4. Lenguajes de programaci´on de alto nivel. . . . . . . . . . . . . . . . . . . . . 71.2.5. Compiladores e int´erpretes. . . . . . . . . . . . . . . . . . . . . . . . . . . . 71.2.6. Python. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.2.7. C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.3. M´as all´a de los programas: algoritmos. . . . . . . . . . . . . . . . . . . . . . . . . . 11
I El lenguaje de programaci´on Python17
2. Una calculadora avanzada19
2.1. Sesiones interactivas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.2. Expresiones aritm´eticas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.2.1. Los operadores aritm´eticos. . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.2.2. Errores de tecleo y excepciones. . . . . . . . . . . . . . . . . . . . . . . . . . 272.3. Tipos de datos. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.3.1. Enteros y flotantes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282.4. Variables y asignaciones. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312.4.1. Asignaciones con operador. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342.4.2. Variables no inicializadas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.5. El tipo de datos cadena. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352.6. Funciones predefinidas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372.7. Funciones definidas en m´odulos. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402.7.1. El m´odulo
math
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402.7.2. Otros m´odulos de inter´es. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3. Programas43
3.1. El entorno PythonG. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.2. Ejecuci´on de programas desde la l´ınea de ´ordenes Unix. . . . . . . . . . . . . . . . . 46
3.3. Entrada/salida. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473.3.1. Lectura de datos de teclado. . . . . . . . . . . . . . . . . . . . . . . . . . . . 483.3.2. M´as sobre la sentencia
print
. . . . . . . . . . . . . . . . . . . . . . . . . . . 493.3.3. Salida con formato. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513.4. Legibilidad de los programas. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 543.4.1. Algunas claves para aumentar la legibilidad. . . . . . . . . . . . . . . . . . . 553.4.2. Comentarios. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Volumen I: Python
i
Leave a Comment