fork download
  1. def add_divisors(list_num):
  2. final_list = []
  3. for number in list_num:
  4. divisors = []
  5. for x in range(1, number + 1):
  6. if number % x == 0:
  7. divisors.append(x)
  8. final_list.append(divisors)
  9. return final_list
  10.  
  11. print(add_divisors([3, 4, 6]))
  12.  
  13. #https://pt.stackoverflow.com/q/485903/101
Success #stdin #stdout 0.02s 9176KB
stdin
Standard input is empty
stdout
[[1, 3], [1, 2, 4], [1, 2, 3, 6]]