Unit 2 Task 45 - Solution

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

Solution - Task 45: Sum of squares pyramid

← Back to task


One possible program:

layer_count = int(input("n: "))
total = 0

for layer in range(1, layer_count + 1):
    total += layer * layer

print("Sum of squares:", total)