User Tools

Site Tools


Writing /var/lib/dokuwiki/data/meta/tutorials/guia_python.meta failed
tutorials:guia_python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:guia_python [2016/09/08 22:52] – [Guía Python] dgarciatutorials:guia_python [2022/09/20 00:08] (current) – external edit 127.0.0.1
Line 2: Line 2:
  
 Guía para aprender conceptos básicos de programación junto al lenguaje de programación Python. Guía para aprender conceptos básicos de programación junto al lenguaje de programación Python.
-Ejercicios tomados de [[http://learnpythonthehardway.org/book/|Learn Python The Hard Way]].+Ejercicios tomados de [[http://learnpythonthehardway.org/python3/|Learn Python The Hard Way]].
  
-Para conocer algunos conceptos básicos previos, puede visitar esta  [[página | https://en.wikiversity.org/wiki/Introduction_to_Programming/About_Programming]]+Para conocer algunos conceptos básicos previos, puede visitar[[https://en.wikiversity.org/wiki/Introduction_to_Programming/About_Programming]]
 ===== Ejercicios sugeridos: ===== ===== Ejercicios sugeridos: =====
  
-  - [[http://learnpythonthehardway.org/book/ex0.html|Instalación del ambiente]] +  - [[http://learnpythonthehardway.org/python3/ex0.html|Instalación del ambiente]] 
-  - [[http://learnpythonthehardway.org/book/ex1.html|Primer programa]] +  - [[http://learnpythonthehardway.org/python3/ex1.html|Primer programa]] 
-  - [[http://learnpythonthehardway.org/book/ex2.html|Comentarios]] +  - [[http://learnpythonthehardway.org/python3/ex2.html|Comentarios]] 
-  - [[http://learnpythonthehardway.org/book/ex3.html|Operaciones matemáticas]] +  - [[http://learnpythonthehardway.org/python3/ex3.html|Operaciones matemáticas]] 
-  - [[http://learnpythonthehardway.org/book/ex4.html|Variables]] +  - [[http://learnpythonthehardway.org/python3/ex4.html|Variables]] 
-  - [[http://learnpythonthehardway.org/book/ex5.html|Variables e impresión]] +  - [[http://learnpythonthehardway.org/python3/ex5.html|Variables e impresión]] 
-  - [[http://learnpythonthehardway.org/book/ex13.html|Paramétros e imports]] +  - [[http://learnpythonthehardway.org/python3/ex13.html|Paramétros e imports]] 
-  - [[http://learnpythonthehardway.org/book/ex14.html|Uso de parámetros]] +  - [[http://learnpythonthehardway.org/python3/ex14.html|Uso de parámetros]] 
-  - [[http://learnpythonthehardway.org/book/ex18.html|Funciones]] +  - [[http://learnpythonthehardway.org/python3/ex18.html|Funciones]] 
-  - [[http://learnpythonthehardway.org/book/ex19.html|Funciones y variables]] +  - [[http://learnpythonthehardway.org/python3/ex19.html|Funciones y variables]] 
-  - [[http://learnpythonthehardway.org/book/ex25.html|Imports de código creado]] +  - [[http://learnpythonthehardway.org/python3/ex25.html|Imports de código creado]] 
-  - [[http://learnpythonthehardway.org/book/ex26.html|Código ajeno]] +  - [[http://learnpythonthehardway.org/python3/ex26.html|Código ajeno]] 
-  - [[http://learnpythonthehardway.org/book/ex27.html|Introducción a la lógica]] +  - [[http://learnpythonthehardway.org/python3/ex27.html|Introducción a la lógica]] 
-  - [[http://learnpythonthehardway.org/book/ex28.html|Práctica de lógica]] +  - [[http://learnpythonthehardway.org/python3/ex28.html|Práctica de lógica]] 
-  - [[http://learnpythonthehardway.org/book/ex29.html|If]] +  - [[http://learnpythonthehardway.org/python3/ex29.html|If]] 
-  - [[http://learnpythonthehardway.org/book/ex30.html|Else]] +  - [[http://learnpythonthehardway.org/python3/ex30.html|Else]] 
-  - [[http://learnpythonthehardway.org/book/ex31.html|Uso de If y Else]] +  - [[http://learnpythonthehardway.org/python3/ex31.html|Uso de If y Else]] 
-  - [[http://learnpythonthehardway.org/book/ex32.html|Ciclos]] +  - [[http://learnpythonthehardway.org/python3/ex32.html|Ciclos]] 
-  - [[http://learnpythonthehardway.org/book/ex33.html|While]]+  - [[http://learnpythonthehardway.org/python3/ex33.html|While]]
  
 ===== Ejercicios extras: ===== ===== Ejercicios extras: =====
  
-  * [[http://learnpythonthehardway.org/book/ex34.html|Listas]] +  * [[http://learnpythonthehardway.org/python3/ex34.html|Listas]] 
-  * [[http://learnpythonthehardway.org/book/ex38.html|Trabajando con listas]] +  * [[http://learnpythonthehardway.org/python3/ex38.html|Trabajando con listas]] 
-  * [[http://learnpythonthehardway.org/book/ex39.html|Diccionarios]]+  * [[http://learnpythonthehardway.org/python3/ex39.html|Diccionarios]]
  
 +===== Algunos Conceptos =====
 +
 +=====Temas=====
 +
 +  * Hola mundo
 +  * Variable e imprimir
 +  * Funcion
 +  * Clase
 +  * Import
 +
 +
 +====Hola Mundo====
 +
 +Abra una terminal y ejecute python. Se va a abrir un interpretador de python.
 +
 +  print "Hola Mundo"
 +  variable_a_imprimir="Hola Mundo 2"
 +  print variable_a_imprimir
 +  a=2
 +  b=3
 +  c=a+b
 +  print c
 +  print 2**100
 +
 +Ahora para salir del interprete de python ejecute el siguiente comando:
 +
 +  exit()
 +
 +Vamos a clonar el material con el que se va a estar trabajando. 
 +
 +  git clone https://github.com/degv364/capacitaciones_python.git
 +
 +==== Loops, variables, listas====
 +
 +Vamos a crear el primer programa en python. Vaya al directorio donde
 +quiere tener su programa.
 +
 +  emacs fibonacci.py
 +
 +Esto va a abrir emacs para poder editar su programa.
 +
 +  #!/usr/bin/env python
 +  #imprimir los primeros 100 terminos no triviales de la
 +  #serie de Fibonacci
 +  def main():
 +      #creamos la variable inicial
 +      finonacci_last=1
 +      fibonacci_last_last=1
 +      for i in range(100):
 +        #creamos el nuevo termino de laserie
 +   fibonacci_current=fibonacci_last+fibonacci_last_last
 +   #hacemos update de los 'last'
 +   fibonacci_last=fibonacci_current
 +   fibonacci_last_last=fibonacci_last
 +   #imprimir el resultado
 +   print fibonacci_current
 +  if __name__=="__main__":
 +     main()
 +
 +Ejecute el programa anterior de la siguiente manera:
 +
 +  python fibonacci.py
 +
 +Como reto. Escriba el programa de manera que se pueda guardar cada término de la serie en una lista.
 +
 +====Funciones====
 +
 +
 +
 +Ahora vamos a trabajar con funciones. Recursividad!
 +
 +  emacs factorial.py
 +
 +
 +Ahora vamos a crear nuestra primera clase
 +
 +Vamos a utilizar nuestra clase. Corramos python
 +
 +  python
 +
 +  number1=complex(1,3)
 +  number2=complex(42,45)
 +  number1.get_real_part()
 +  number2.get_imaginary_part()
 +  result=number1+number2
 +  print str(result.get_real_part())+ " + i" + str(result.get_imaginary_part())
 +===== Estilos =====
 +En el Arcos-Lab sugerimos seguir la siguiente [[https://www.python.org/dev/peps/pep-0008/|guía de estilo]] de programación para Python.
tutorials/guia_python.1473375159.txt.gz · Last modified: 2022/09/20 00:08 (external edit)