Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # TODA COLECCION ES ITERABLE (lista, cadena, diccionario...)
- nombres = ["juan", "osvaldo", "ana", "karen", "luisa"]
- frase = "Hola a todos"
- """
- Ejemplos de range
- range(valor inicial, tope, salto)
- 1. range(2,14,3) -> [2,5,8,11]
- 2. range(15,-16, -4) -> [15,11,7,3,-1,-5,-9,-13]
- 3. range(10) -> [0,1,2,3,4,5,6,7,8,9] valores x defecto: inicio=0, salto=1
- 4. range(4,10) -> [4,5,6,7,8,9] valor x defecto: salto=1
- """
- for nombre in nombres: # for <iterador> in <iterable>:
- print(nombre)
- for caracter in frase:
- print(caracter)
- for numero in range(100,20,-20): # range(valor inicial, valor final, salto)
- print(numero)
Add Comment
Please, Sign In to add comment