Back to Freecodecamp

Step 11

curriculum/challenges/english/blocks/learn-list-comprehension-by-building-a-case-converter-program/657f025ec86c3d7c4177b6be.md

latest1017 B
Original Source

--description--

With the function complete, you can now use it inside another function.

Create a new function called main() with pass as the body of the function.

--hints--

You should define a new function named main(). Don't forget the colon at the end and use pass to fill the function body.

js
({
  test: () => {
    assert(runPython(`
      import inspect
      inspect.isfunction(main)
    `));
  }
})

--seed--

--seed-contents--

py
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
--fcc-editable-region--


--fcc-editable-region--