Created
August 28, 2020 07:09
-
-
Save kurzweil777/3936256308ca9799f56268f522cb38c1 to your computer and use it in GitHub Desktop.
Exercise from the CodeWars
This file contains 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 solve(n): | |
f0, f1 = "0", "01" | |
if n == 0: | |
return f0 | |
elif n == 1: | |
return f1 | |
elif n > 1: | |
for i in range(2, n + 1): | |
b = f0 | |
f0 = f1 | |
f1 = b + f0 | |
return f1 | |
print((solve(0), '0')) | |
print((solve(3), '01001')) | |
print((solve(5), '0100101001001')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment