Skip to content

Commit

Permalink
suggestion resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
larymak committed Mar 25, 2024
1 parent 60dce15 commit 873b86b
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 11 deletions.
Expand Up @@ -11,7 +11,7 @@ In this project, you are going to learn about list comprehensions in Python by b

List comprehensions in Python are a concise way to construct a list without using loops or the `.append()` method. Apart from being briefer, list comprehensions often run faster.

To begin, define a new function named `convert_to_snake_case()` that takes `pascal_or_camel_cased_string` as input. Within the function body, include a `pass` statement to mark the starting point of our case conversion.
To begin, define a new function named `convert_to_snake_case()` that takes `pascal_or_camel_cased_string` as input. Within the function body, include a `pass` statement to mark the starting point of your case conversion.

# --hints--

Expand Down
Expand Up @@ -7,9 +7,7 @@ dashedName: step-3

# --description--

With the empty list in place, the next step is to iterate through the input string and convert each character to snake case using a `for` loop.

In Python, a `for` loop is used to iterate over a sequence *(like a list, tuple, string)* or other iterable objects. Iterating over a sequence is called traversal.
With the empty list in place, iterate through the input string and convert each character to snake case using a `for` loop. Iterating over a sequence is called traversal.

```python
# For Loop Example
Expand Down
Expand Up @@ -7,9 +7,7 @@ dashedName: step-5

# --description--

You'll need to transform uppercase characters into lowercase and add an underscore at the beginning of each converted character.

To achieve this, the `.lower()` string method is used to convert uppercase characters to lowercase characters. Then concatenate an underscore to the character using the plus sign.
You'll need to transform uppercase characters into lowercase and add an underscore at the beginning of each converted character. Then concatenate an underscore to the character using the plus sign.

```python
'_' + char.lower()
Expand Down
Expand Up @@ -9,7 +9,7 @@ dashedName: step-10

To wrap up the fucntion, return the `clean_snake_cased_string`. This will complete the function and allow you to use it to convert strings from pascal or camel case to snake case.

Add a `return` statement at the end of the fucntion to return the `clean_snake_cased_string`.
Add a `return` statement at the end of the function to return the `clean_snake_cased_string`.


# --hints--
Expand Down
Expand Up @@ -7,7 +7,7 @@ dashedName: step-11

# --description--

With the fucntion complete, you can now use it inside another function.
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.

Expand Down
Expand Up @@ -7,7 +7,9 @@ dashedName: step-12

# --description--

Inside the `main()` function, replace `pass` with a `convert_to_snake_case()` call. Pass the string `'aLongAndComplexString'` as input to the function and print out the output using the `print()` function.
Inside the `main()` function, replace the `pass` statement, with a call to `convert_to_snake_case()`, passing the string `'aLongAndComplexString'` as input.

To display the output, enclose the fucntion call within the `print()` function.

# --hints--

Expand Down
Expand Up @@ -21,7 +21,7 @@ snake_cased_char_list = [

And there you have it. These three lines of code do the same task as the `for` loop you worked on previously while being cleaner and somewhat faster.

Still within the square braces asfter the `else clause, add this last line of code to iterate over the characters of the string in your list comprehension.
Still within the square braces after the `else clause, add this last line of code to iterate over the characters of the string in your list comprehension.

# --hints--

Expand Down

0 comments on commit 873b86b

Please sign in to comment.