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

when i tried to follow the instruction the same issue happeng : i typed convert_to_snake_case(‘aLongAndComplexString’)
print(convert_to_snake_case)

def convert_to_snake_case(pascal_or_camel_cased_string):
    snake_cased_char_list = []
    for char in pascal_or_camel_cased_string:
        if char.isupper():
            converted_character = '_' + char.lower()
            snake_cased_char_list.append(converted_character)
        else:
            snake_cased_char_list.append(char)
    snake_cased_string = ''.join(snake_cased_char_list)
    clean_snake_cased_string = snake_cased_string.strip('_')

    return clean_snake_cased_string


# User Editable Region

def main():
    convert_to_snake_case('aLongAndComplexString')
    print(convert_to_snake_case)


# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36

Challenge Information:

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

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.

1 Like

you need to print the output of the function call, you need to have one single line here

1 Like

print(convert_to_snake_case(‘aLongAndComplexStrig’))
i tried this but its still not working sir

If this is the code you tried, you have a typo to correct in the string.

1 Like

got it it is typo error .
i did strig instead of string. thank you
the correct code is:
–removed–

1 Like

Please don’t post the solution, thanks!

1 Like

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