Skip to content

Instantly share code, notes, and snippets.

@impredicative
Created October 6, 2017 23:23
Show Gist options
  • Save impredicative/98705f544be42fd32fa7f42ee7f40146 to your computer and use it in GitHub Desktop.
Save impredicative/98705f544be42fd32fa7f42ee7f40146 to your computer and use it in GitHub Desktop.
Recursive FizzBuzz
def fizzbuzz_recursive(n):
if n == 0:
return
fizzbuzz_recursive(n - 1)
if n % 3 == 0 and n % 5 == 0:
print('FizzBuzz')
elif n % 3 == 0:
print('Fizz')
elif n % 5 == 0:
print('Buzz')
else:
print(n)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment