Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Integer Sign Determination by imloafer
def determine_sign(num: int) -> str:
# your code here
return ["zero", "positive", "negative"][num and int(num/abs(num))]
print("Example:")
print(determine_sign(11))
# These "asserts" are used for self-checking
assert determine_sign(5) == "positive"
assert determine_sign(0) == "zero"
assert determine_sign(-10) == "negative"
assert determine_sign(1) == "positive"
assert determine_sign(-1) == "negative"
assert determine_sign(999) == "positive"
assert determine_sign(-1000) == "negative"
assert determine_sign(123456789) == "positive"
assert determine_sign(-987654321) == "negative"
assert determine_sign(2) == "positive"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 6, 2023