Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Fizzt And Buzzt solution in Clear category for Fizz Buzz by niillos
# Taken from mission Just Fizz!
def checkio(num: int) -> str:
# Fizz Buzz
if ( ((num % 3) == 0) and ((num % 5) == 0) ) :
out_str = "Fizz Buzz"
# Fizz
elif ((num % 3) == 0):
out_str = "Fizz"
# Buzz
elif ((num % 5) == 0):
out_str = "Buzz"
# All other cases
else:
out_str = str(num)
return out_str
print("Example:")
print(checkio(15))
# These "asserts" are used for self-checking
assert checkio(15) == "Fizz Buzz"
assert checkio(6) == "Fizz"
assert checkio(10) == "Buzz"
assert checkio(7) == "7"
print("The mission is done! Click 'Check Solution' to earn rewards!")
Oct. 22, 2023