easy +5 pts

Sign of a Number

Return 'positive', 'negative', or 'zero' based on the input number.

Write a function `sign_of_number(n: float) -> str` that takes a numeric value `n` and returns: - `"positive"` if `n > 0` - `"negative"` if `n < 0` - `"zero"` if `n == 0` No imports are allowed. Input will be a real number (integer or float).

Constraints

Input will be a real number (int or float). Do not use any external libraries.

Example

>>> sign_of_number(5)
'positive'
>>> sign_of_number(-2.5)
'negative'
>>> sign_of_number(0)
'zero'
5 points ~5 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use if-elif-else statements.
Compare n to 0 in each condition.
Return exactly one of the three strings.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.