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
PostgreSQLv16

Här visas resultatet av din kod

Visible tests
1
Input
-10
Expected-1
2
Input
10
Expected1
3
Input
0
Expected0
4
Input
-20.5
Expected-1
5
Input
20.5
Expected1
6
Input
-0.000001
Expected-1
Focus radio
Paused · SomaFM · Fluid