0 out of 464 challenges solved
Write a Python function `snake_to_camel` that converts a given snake_case string into a CamelCase string. #### Requirements: - The input will be a string in snake_case format (e.g., `"example_string"`). - The output should be a string in CamelCase format (e.g., `"ExampleString"`). #### Example Usage: ```python [main.nopy] print(snake_to_camel("android_tv")) # Output: "AndroidTv" print(snake_to_camel("google_pixel")) # Output: "GooglePixel" print(snake_to_camel("apple_watch")) # Output: "AppleWatch" ``` #### Constraints: - Assume the input string will only contain lowercase letters and underscores. - The input string will not start or end with an underscore, and there will be no consecutive underscores.
def snake_to_camel(snake_str): """ Convert a snake_case string to CamelCase. Args: snake_str (str): The input string in snake_case format. Returns: str: The converted string in CamelCase format. """ # Split the string by underscores and capitalize each part # Join the parts together to form the CamelCase string pass # Replace this with your implementation