Skip to content

Instantly share code, notes, and snippets.

@carcigenicate
Created August 15, 2019 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carcigenicate/3cd9dd7bbcbe8b2e7e3620c6b6df33a4 to your computer and use it in GitHub Desktop.
Save carcigenicate/3cd9dd7bbcbe8b2e7e3620c6b6df33a4 to your computer and use it in GitHub Desktop.
def face_crowd(n: int) -> str:
def rec(depth: int, left: bool = False) -> str:
if depth >= n:
return ""
elif depth == 0:
return rec(depth + 1, True) + '( ͡° ͜ʖ ͡°)' + rec(depth + 1, False)
elif depth == 1:
return (rec(depth + 1, True) + '( ͡° ͜ʖ') if left else ('ʖ ͡°)' + rec(depth + 1, False))
else:
return (rec(depth + 1, True) + '( ͡°') if left else ('͡°)' + rec(depth + 1, False))
return rec(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment