Python: Basic: Factors

Write the function factors that takes an integer n and returns a list containing all factors of n.


factors(10) -> [1, 2, 5, 10]
factors(1000) -> [1, 2, 4, 5, 8, 10, 20, 25, 40, 50, 100, 125, 200, 250, 500, 1000]

Test 1    

Test 2    

Test 3    

Test 4    

Test 5    

Test 6