-3

I am confused on how my code is not turning all strings into lowercase?

def set_lowercase(strings):
    """ lower the case 2. """
    return [i.lower() for i in strings]


strings = ['Right', 'SAID', 'Fred']
set_lowercase(strings)
print(strings)
0

3 Answers 3

3

You need to assign the result of your function call to the variable strings:

strings = set_lowercase(strings)
Sign up to request clarification or add additional context in comments.

Comments

1

set_lowercase(strings) doesn't modify the input in-place.
It returns a list of strings.

So, write strings = set_lowercase(strings) instead.

Comments

0

Your function builds a new list and returns it, but the calling code doesn't do anything with the returned value.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.