Skip to content

Instantly share code, notes, and snippets.

@amites
Created September 10, 2016 16:28
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 amites/226cfd615d464ade8745fc9035892c85 to your computer and use it in GitHub Desktop.
Save amites/226cfd615d464ade8745fc9035892c85 to your computer and use it in GitHub Desktop.
Camel Case Code Wars
# https://www.codewars.com/kata/convert-string-to-camel-case/train/python
def to_camel_case(text):
text_list = text.replace('-', '_').split('_')
answer_list = [text_list[0], ]
for word in text_list[1:]:
answer_list.append( word.title() )
return ''.join(answer_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment