Integer Sign Determination

Integer Sign Determination

Identify whether a given integer is positive, negative, or zero and return a respective string: "positive", "negative" or "zero".

example

Input: Integer (int).

Output: String (str).

Examples:

assert determine_sign(5) == "positive"
assert determine_sign(0) == "zero"
assert determine_sign(-10) == "negative"
assert determine_sign(1) == "positive"

How it’s used: understanding the sign of a number can be useful in financial software, scientific simulations, and many algorithms to determine subsequent logic.

Precondition:

  • num ∈ Z.