Case Converter Program - Step 21

Tell us what’s happening:

I have removed all the # comments , I don’t understand what is wrong with the code

Your code so far

def convert_to_snake_case(pascal_or_camel_cased_string):

# User Editable Region

      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


    snake_cased_char_list = [
        '_' + char.lower() if char.isupper()
        else char
        for char in pascal_or_camel_cased_string
    ]

    return ''.join(snake_cased_char_list).strip('_')

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

if __name__ == '__main__':
    main()

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) 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 21

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.

I understood what I did wrong.

Hi @Tarzan112345678

Here is a comparison of your code with the original.

The red code is the original code.
Underneath it is your code, in blue.

The magenta shows the overlap.

The instructions asked you to remove the commented out lines.
You appear to have removed only the hash symbols.

You need to remove the entire line.

Happy coding