Learn-list-comprehension-by-building-a-case-converter-program Step 5

Me again…
I am sorry but I am not able to copy the template link as I have been told and I am adding the screen shot.
step 5

I do not know what I am doing wrong and I need some input…Thanks…

Please post your actual code instead of a screenshot. Also, please post a link to the Step. Thanks

@AbdulioUnited
It is not as complicated, it is a bit simpler.

Let’s read the request of that step 5

Inside the if statement body, you need to convert any uppercase character to lowercase and prepend an underscore to this lowercase character.
Use the .lower() string method to convert uppercase characters to lowercase characters. You can then concatenate an underscore to the character using the plus sign.

'_' + char.lower()

Assign the modified character to a variable named converted_character inside the if statement body.

Three sections. The first one it tells you that you must do that in the if block. That only means the pass keyword needs to disapear.
The second section it gives you the code you need to use

'_' + char.lower()

The third section it asks you to create a variable named converted_character and assign (=) that code to it.

1 Like

Thank you so much @anon28508191 …this morning reading again the asked steps and with your input I make it…
Thank you so much

Hi @JeremyLT indeed I want to follow the rules. When you say post the actual call you meant something like this:

if char.isupper():
            char.lower()
            '_' + char.lower()
    converted_character = '_' + char.lower()
    pass

and paste the link like this: https://www.freecodecamp.org/learn/scientific-computing-with-python/learn-list-comprehension-by-building-a-case-converter-program/step-5
I noticed that the like doesn’t take my code anly the step
Thank you again for your help

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

1 Like