Learn Python List Comprehension By Building a Case Converter Program - Step 15

Begin the transition to comprehensions by commenting out all the lines of code inside the convert_to_snake_case() function. Don’t delete them as they’ll be helpful when you implement the logic using a list comprehension.

Remember to add the pass keyword to the function body to prevent the code from failing during the tests.

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_string = ‘’.join(snake_cased_char_list)
clean_snake_cased_string = snake_cased_string.strip('

return clean_snake_cased_string

I comment out everything and comment out 10 lines with hastag # still none of them worked ? any help please

Welcome to our community!

You must add the hashtag in front of each code line, and maintain the same indentation (alignment) of the existing code (given in this challenge by default). Python is very sensitive when it comes to indentation. Don’t change it.

Thanks for your answer however, indentation is correct at least “pass” phrase and when you comment out there is no importance of indentation i believe. Anyway, still i cant pass this phase and i dont understand what is wrong. It is very simple task however it doesnt accept my answer.

Try indenting the comment #'s as well

def convert...:

Like this. Maybe a space between the # and code as wel:

def convert...:
    # code
    # code

it worked, thanks a lot :slightly_smiling_face:

I struggled with this for an hour and really not sure why does it matter. I asked dev friends and bard/chatgpt, neither think it matters.

In my opinion, commenting out at the beginning of a line is better. Like if you go through large code with large functions and you’re skimming through it, you kinda need to skim up-down and left-right because there may be some commented out code.
With # at beginning of line it seems easier to skim up-down only and see whether it’s a comment or there’s code commented out easily.

I have tried all the options my is still refusing. I have even tried reseting but it still refuses.

Solved. I figured out the problem by revisiting the instructions. I had commented out everything.