Finding divisors

Write code · Basic · §2.2 Divisors and multiples

Complete the function solution, which returns a list of the divisors of the positive integer n in ascending order.

Function

solution(n)

Constraints

Examples

nresult
12[1, 2, 3, 4, 6, 12]
7[1, 7]

Starter code

def solution(n):
    answer = []
    return answer

Solve this problem in your browser

Python runs in your browser and checks your answer right away. Hints and the answer are on the problem page.