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

Tu sa zobrazí výsledok spustenia kódu

Tests12
Visible tests
Skrytý test 7
Skrytý test 8
Skrytý test 9
Skrytý test 10
Skrytý test 11
Skrytý test 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