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

Šeit parādīsies koda izpildes rezultāts

Tests12
Visible tests
Slēptais tests 7
Slēptais tests 8
Slēptais tests 9
Slēptais tests 10
Slēptais tests 11
Slēptais tests 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