Hackbright Code Challenges

Snake Case to Camel Case: Solution

Snake Case to Camel Case: Solution

Problem

Snake Case to Camel Case

Whiteboard

Easier

Concepts

Strings

Download

snake-to-camel-solution.zip


case.py
def snake_to_camel(variable_name):
    """Given a variable name in snake_case, return camelCase of name."""

    # START SOLUTION

    words = variable_name.split("_")

    for i in range(1, len(words)):
        words[i] = words[i].capitalize()

    return "".join(words)