Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Integer Sign Determination by nikolaypasevich
def determine_sign(num:int) ->str:
return (('positive','negative')[num<0],'zero')[num==0]
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!")
Feb. 27, 2024