0 out of 464 challenges solved

Sum of Divisors

Write a Python function `sum_of_divisors(n)` that calculates and returns the sum of all divisors of a given positive integer `n`. A divisor of a number is any integer that divides it without leaving a remainder.

#### Example Usage
```python [main.nopy]
print(sum_of_divisors(8))  # Output: 15 (1 + 2 + 4 + 8)
print(sum_of_divisors(12)) # Output: 28 (1 + 2 + 3 + 4 + 6 + 12)
print(sum_of_divisors(7))  # Output: 8 (1 + 7)
```

#### Constraints
- The input `n` will always be a positive integer greater than 0.
def sum_of_divisors(n):
    """
    Calculate the sum of all divisors of a given positive integer n.

    Args:
    n (int): A positive integer.

    Returns:
    int: The sum of all divisors of n.
    """
    # Placeholder for the solution
    pass