fork download
  1. def fatorial_range(n):
  2. """ Retorna o fatorial de todos os nĂºmeros entre 1 e n """
  3. next_value = 1
  4. for i in range(1, n+1):
  5. yield next_value
  6. next_value *= i + 1
  7.  
  8. for fat in fatorial_range(5):
  9. print(fat)
Success #stdin #stdout 0.04s 9276KB
stdin
Standard input is empty
stdout
1
2
6
24
120