fork(3) download
  1. def get_multis(n, i, j):
  2. x = 0
  3. while n > 0:
  4. if(x%i == 0 or x%j == 0): # modulo para ver se e multiplo de algum ou ambos
  5. yield x
  6. n -= 1
  7. x += 1
  8.  
  9. n, i, j = 6, 2, 3
  10. print(list(get_multis(n, i, j))) # [0, 2, 3, 4, 6, 8]
Success #stdin #stdout 0.02s 9372KB
stdin
Standard input is empty
stdout
[0, 2, 3, 4, 6, 8]