Complete the method/function so that it converts dash/underscore delimited words into camel casing. The first word within the output should be capitalized only if the original word was capitalized (known as Upper Camel Case, also often referred to as Pascal case).
Examples:
to_camel_case("the-stealth-warrior") # returns "theStealthWarrior"
to_camel_case("The_Stealth_Warrior") # returns "TheStealthWarrior"
def to_camel_case(text):
pass
def to_camel_case(text):
text = text.replace("-", " ").replace("_", " ")
words = text.split()
return "".join([w.capitalize() if w != words[0] else w for w in words])
def to_camel_case(s):
return s[0] + s.title().translate(None, "-_")[1:] if s else s