Unit 4 Task 11 - Solution

Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.

Solution - Task 11: Count divisors

← Back to task


One possible program:

def count_divisors(n):
    c = 0
    for d in range(1, n + 1):
        if n % d == 0:
            c += 1
    return c

print(count_divisors(6))