Created
October 6, 2017 23:23
-
-
Save impredicative/98705f544be42fd32fa7f42ee7f40146 to your computer and use it in GitHub Desktop.
Recursive FizzBuzz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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