Brice
December 28, 2023, 4:40pm
1
Tell us what’s happening:
Describe your issue in detail here.
Hi team, I can’t go beyond this step. I tried many times.
Your code so far
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0
Challenge Information:
Learn Python List Comprehension By Building a Case Converter Program - Step 12
Learn to Code — For Free
system
December 28, 2023, 4:40pm
2
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.
im59138
December 28, 2023, 4:44pm
3
is this prinnting the output of the function?
Brice
December 28, 2023, 5:03pm
4
Even when I print(‘aLongAndComplexString’) I have the sme error:
Sorry, your code does not pass. Don’t give up.
You should call convert_to_snake_case()
inside the main()
function and pass aLongAndComplexString
as input to the function.
juanca
December 28, 2023, 5:12pm
5
When you try to print the following:
It won’t print anything because you’re not declaring the function, and is missing an argument, like this: convert_to_snake_case('This is an example string')
.
To get the result that you want, you are almost there. Just print out your line above:
1 Like
Brice
December 28, 2023, 9:42pm
6
Here is the whole code:
def main():
convert_to_snake_case('aLongAndComplexString')
print(convert_to_snake_case)
It does not pass.
Brice
December 28, 2023, 9:48pm
7
I solved the issue. Thanks
1 Like
system
Closed
June 28, 2024, 9:49am
8
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.