Compare the Squares

Here you need to carefully compare two similar-looking but different values. The function difference_of_squares receives number and calculates both the square of the sum of the first number natural numbers and the sum of their squares. Return the difference: the square of the sum minus the sum of the squares.

Примеры

Ввод
1
Вывод
0
Ввод
5
Вывод
170
Ввод
10
Вывод
2640

Нужно реализовать

def difference_of_squares(number: int) -> int:

Теги

math
PostgreSQLv16

Itt jelenik meg a kód futtatásának eredménye

Tests12
Visible tests
Rejtett teszt 7
Rejtett teszt 8
Rejtett teszt 9
Rejtett teszt 10
Rejtett teszt 11
Rejtett teszt 12

They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.

Focus radio
Paused · SomaFM · Fluid