Learn Python List Comprehension by Building a Case Converter Program - Step 7

Tell us what’s happening:

Describe your issue in detail here.
what am i doin g wrong

Your code so far

def convert_to_snake_case(pascal_or_camel_cased_string):
    snake_cased_char_list = []
    for char in pascal_or_camel_cased_string:

# User Editable Region

        if char.isupper():
            converted_character = '_' + char.lower()
            snake_cased_char_list.append(converted_character)
        else :
            snake_cased_char_list.append(char)

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36

Challenge Information:

Learn Python List Comprehension by Building a Case Converter Program - Step 7

You appear to have created this post without editing the template. Please edit your post to Tell us what’s happening in your own words.

Hello there!
I think the space you created between the else and : is the one raising the error so try deleting it and try again plus also mind about the indentation. Hope that helps

i try that too but still nothing

if char.isupper():
converted_character = ‘_’ + char.lower()
snake_cased_char_list.append(converted_character)
else :
snake_cased_char_list.append(char)

Hi @mkj3480

Remove the space before the colon as @ceasor-elvis suggested. :blush:

Happy coding

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.