Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # Un lenguaje es Turing Completo cuando puede evaluar cualquier función
- # computable
- #
- # Cualquier función computable puede ser descripta como una combinaciòn
- # de bucles y condicionales lògicos
- #
- # Se necesitan al menos 1 condicional, 1 bucle definido, 1 bucle indefinido
- #
- # if, for, while
- #
- """
- edad = int(input("Ingrese su edad: "))
- if 0 < edad < 16:
- print("Voto prohibido")
- elif 16 <= edad < 18 or edad > 70:
- print("Voto optativo")
- elif 18 <= edad < 70:
- print("Voto obligatorio")
- else:
- print("Error en el ingreso de la edad")
- """
- # bucle indefinido
- nombres = ["Juan","Hugo","Ana"]
- i = 0
- while(i < len(nombres)):
- print(nombres[i])
- i += 1
- # bucle definido: for <variable iteradora> in <iterable>:
- # TODA COLECCION ES ITERABLE
- for nombre in nombres:
- print(nombre)
- for letra in "HIOIO":
- print(letra,end=" ")
- print()
- for numero in range(101):
- print(numero)
- nombres = ["Ana","Juana","Tito"]
- notas = [10,8,9]
- for nombre,nota zip(nombres,notas):
- print(nombre,nota)
Advertisement
Add Comment
Please, Sign In to add comment