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/13 23:44] – [Hola Mundo] 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: [[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 ===== ===== Algunos Conceptos =====
Line 106: Line 106:
   emacs factorial.py   emacs factorial.py
  
- 
-  #!/usr/bin/env python 
-  #este programa utiliza recursividad! para calcular el factorial! 
- 
-  def factorial(n): 
-      if n==0: 
-      reutrn 1 #factorial de 0 es 1. 0!=1 
- 
-      else: 
- return n*factorial(n-1) # n!= n*(n-1)! 
- 
-  def main(): 
-      #le solicitamos al usuario un numero al cual calcular el factorial 
-      print "Estimado usuario, digite un entero" 
-      number=int(raw_input()) 
- 
-      #calculamos el factorial 
-      print str(factorial(number)) 
- 
-  if __name__=="__main__": 
-      main() 
  
 Ahora vamos a crear nuestra primera clase Ahora vamos a crear nuestra primera clase
- 
-  #!/usr/bin/env python 
-  #En este programa creamos una clase 
-  #Numeros complejos 
- 
-  class complex(object): 
-  def __init__(self, real_input=0, img_input=0): #metodo contructor 
- #0 es el numero pro defecto 
- self.real = real_input 
- self.img  = img_input 
- 
-        def get_real_part(self): 
- return self.real 
- 
- def get_imaginary_part(self): 
- return self.img 
- 
- def get_magnitude(self): 
- return self.real**2+self.img**2 
- 
- def __add__ (self, other): 
- #se suman self, y other. Ambos complejos 
- #se reurna un nuevo complejo con el resultado 
- real_result=self.real+other.get_real_part() 
- img_result=self.img+other.get_imaginary_part() 
- 
- return complex(real_result, img_result) 
  
 Vamos a utilizar nuestra clase. Corramos python Vamos a utilizar nuestra clase. Corramos python
tutorials/guia_python.1473810246.txt.gz · Last modified: 2022/09/20 00:08 (external edit)