Flip the Sign
The opposite of a number is the same distance from zero, but on the other side of the number line. Write opposite, which takes number and returns it with the sign flipped. A positive number becomes negative, a negative number becomes positive, and 0 stays 0.
Примеры
Ввод
1Вывод
-1Ввод
-5Вывод
5Ввод
0Вывод
0Нужно реализовать
def opposite(number: int) -> int:
Теги
math
Logga in för att se historik över inskick
Logga inLogga in för att använda AI-mentorn
Logga inVisible tests
1
Input
1Expected
-12
Input
-5Expected
53
Input
0Expected
04
Input
14Expected
-145
Input
-9Expected
96
Input
1000Expected
-1000Focus radio
Paused · SomaFM · Fluid