Python Introducción a la Programación

51
Python Introducción a la Programación Rogelio Ferreira Escutia Profesor / Investigador Tecnológico Nacional de México Campus Morelia

Transcript of Python Introducción a la Programación

Page 1: Python Introducción a la Programación

Python

Introducción a laProgramación

Rogelio Ferreira Escutia

Profesor / InvestigadorTecnológico Nacional de MéxicoCampus Morelia

Page 2: Python Introducción a la Programación

Contenido Versión de Python Intérprete de Python Hola Mundo en Python Zen of Python Comentarios Impresión de datos Variables Tipos de datos Operadores

Page 3: Python Introducción a la Programación

Versión de Python

Page 4: Python Introducción a la Programación

4

Python - Versión Para ver la versión instalada (en consola):

Page 5: Python Introducción a la Programación

5

Python - Actualización Si no está actualizado para Python3 se abre la siguiente

ventana para que inicie la instalación (en sistemas MacOS):

Page 6: Python Introducción a la Programación

Intérprete de Python

Page 7: Python Introducción a la Programación

7

Python - Intérprete Para “entrar” al intérprete de Python (en consola) hay que

teclear:python

Page 8: Python Introducción a la Programación

8

Python - Intérprete

-

Para “salir” del intérprete de Python (en consola) hay que teclear:exit()

Page 9: Python Introducción a la Programación

Hola Mundo en Python

Page 10: Python Introducción a la Programación

10

Python – Hola Mundo (consola)

.

> nano hola.py

> python3 hola.py

Hola Crayola!!!

Page 11: Python Introducción a la Programación

11

Python – Hola mundo (con VSCode)

.

Abrir el archivo con el Visual Studio Code (previamente instalado)

Page 12: Python Introducción a la Programación

12

Python – Hola mundo (con VSCode)

.

Abrir el archivo con el Visual Studio Code (previamente instalado) y correrlo en la consola:

Page 13: Python Introducción a la Programación

Zen of Python

Page 14: Python Introducción a la Programación

14

Zen of Python

.

Es una lista de principios de diseño para el lenguaje Python:

Page 15: Python Introducción a la Programación

15

Page 16: Python Introducción a la Programación

Comentarios

Page 17: Python Introducción a la Programación

17

Comentarios

.

Para poner comentarios en nuestro código:

Page 18: Python Introducción a la Programación

Impresión de datos

Page 19: Python Introducción a la Programación

19

Imprimir mensaje

.

Usando comillas:

Page 20: Python Introducción a la Programación

Variables

Page 21: Python Introducción a la Programación

21

Asignación de valores a variables

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 22: Python Introducción a la Programación

22

Manejo de variables

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 23: Python Introducción a la Programación

Tipos de Datos

Page 24: Python Introducción a la Programación

24

Enteros (int)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 25: Python Introducción a la Programación

25

Cadenas (strings)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 26: Python Introducción a la Programación

26

Boleanas (boolean)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 27: Python Introducción a la Programación

Operadores

Page 28: Python Introducción a la Programación

28

Operadores Aritméticos

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 29: Python Introducción a la Programación

29

Operadores de comparación

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 30: Python Introducción a la Programación

30

Operadores Boleanos

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 31: Python Introducción a la Programación

Toma de Decisiones

Page 32: Python Introducción a la Programación

32

Toma de decisiones (if)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 33: Python Introducción a la Programación

Ciclos

Page 34: Python Introducción a la Programación

34

Ciclos de enteros

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 35: Python Introducción a la Programación

35

Ciclos de un rango de enteros

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 36: Python Introducción a la Programación

36

Ciclo de una cadena

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 37: Python Introducción a la Programación

37

Ciclo de una lista

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 38: Python Introducción a la Programación

Ciclos condicionales

Page 39: Python Introducción a la Programación

39

Ciclos condicionales (while)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Page 40: Python Introducción a la Programación

Funciones integradas

Page 41: Python Introducción a la Programación

41

Funciones integradas

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Python cuenta con algunas funciones ya integradas al lenguaje:

Page 42: Python Introducción a la Programación

Funciones matemáticas

Page 43: Python Introducción a la Programación

43

Funciones matemáticas (1)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

La librería “math” cuenta con algunas funciones:

Page 44: Python Introducción a la Programación

44

Funciones matemáticas (2)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

La librería “math” cuenta con algunas funciones:

Page 45: Python Introducción a la Programación

Binario, Octal y Hexadecimal

Page 46: Python Introducción a la Programación

46

Binario, Octal y Hexadecimal

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Python cuenta con funciones para manejar estos números:

Page 47: Python Introducción a la Programación

Manejo de Cadenas

Page 48: Python Introducción a la Programación

48

Manejo de cadenas (1)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Python cuenta con funciones para manejo de cadenas:

Page 49: Python Introducción a la Programación

49

Manejo de cadenas (2)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Python cuenta con funciones para manejo de cadenas:

Page 50: Python Introducción a la Programación

50

Manejo de cadenas (3)

"Python All in one for Dummies", John Sovic y Alan Simpson, Jhon Wiley and Sons Editorial, New Jersey USA 2019

Python cuenta con funciones para manejo de cadenas:

Page 51: Python Introducción a la Programación

Rogelio Ferreira Escutia

Profesor / InvestigadorTecnológico Nacional de MéxicoCampus Morelia

xumarhu.net

@rogeplus

https://www.youtube.com/channel/UC0on88n3LwTKxJb8T09sGjg

[email protected]

[email protected]

rogelioferreiraescutia