Skip to content

Instantly share code, notes, and snippets.

@isagalaev
Created July 23, 2017 09:15
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 isagalaev/47c1dd5e74eb1bdb00daef722f08ef66 to your computer and use it in GitHub Desktop.
Save isagalaev/47c1dd5e74eb1bdb00daef722f08ef66 to your computer and use it in GitHub Desktop.
DICT = {'hi', 'there', 'hit', 'here'}
def camelcase(tail, head=''):
heads = [head.title()] if head in DICT else []
return ([h + t for h in heads for t in camelcase(tail)] + camelcase(tail[1:], head + tail[0])
if tail else heads)
print(camelcase('hithere'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment