Number Sign
Sometimes the exact value of a number matters less than whether it is positive, negative, or zero. Given a number num, return 1 if it is positive, -1 if it is negative, and 0 if it is zero.
Примеры
Ввод
-10Вывод
-1Ввод
10Вывод
1Ввод
0Вывод
0Нужно реализовать
def signum(num: float) -> int:
Теги
math
Влез, за да видиш историята на решенията
ВходВлез, за да използваш ИИ ментора
ВходVisible tests
1
Input
-10Expected
-12
Input
10Expected
13
Input
0Expected
04
Input
-20.5Expected
-15
Input
20.5Expected
16
Input
-0.000001Expected
-1Focus radio
Paused · SomaFM · Fluid