Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Fizz Buzz by m.kleinkranenbarg
def checkio(number: int) -> str:
result = ''
if number % 3 == 0:
result += 'Fizz'
if number %5 == 0:
result += ' Buzz'
return result.strip() if result else str(number)
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!")
Feb. 25, 2023
Comments: