0 out of 464 challenges solved
Write a Python function `difference(n)` that calculates the difference between the sum of the cubes of the first `n` natural numbers and the sum of the first `n` natural numbers. #### Example Usage ```python [main.nopy] print(difference(3)) # Output: 30 print(difference(5)) # Output: 210 print(difference(2)) # Output: 6 ``` #### Constraints - The input `n` will be a positive integer.
def difference(n):
"""
Calculate the difference between the sum of the cubes of the first n natural numbers
and the sum of the first n natural numbers.
Args:
n (int): A positive integer.
Returns:
int: The calculated difference.
"""
# Placeholder for the solution
pass