Skip to content

Instantly share code, notes, and snippets.

@kurzweil777
Created August 28, 2020 07:09
Show Gist options
  • Save kurzweil777/3936256308ca9799f56268f522cb38c1 to your computer and use it in GitHub Desktop.
Save kurzweil777/3936256308ca9799f56268f522cb38c1 to your computer and use it in GitHub Desktop.
Exercise from the CodeWars
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