Advertisement
Fhernd

patron-iteracion-personalizado.py

Jun 12th, 2018
1,862
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def generar_rango_flotante(inicio, fin, incremento):
  2.     x = inicio
  3.  
  4.     while x < fin:
  5.         yield x
  6.         x += incremento
  7.  
  8. for n in generar_rango_flotante(0, 4, 0.5):
  9.     print(n)
  10.  
  11. L = list(generar_rango_flotante(0, 1, 0.3))
  12.  
  13. print(L)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement