Why is my return value not correct?


#1

Question

Why is my return value not correct?

Answer

The instructions ask for the entire list to be returned, so if you’re only returning a single modified element, that is the issue. Instead, what we want to do is modify the element, and then on the next line write our return statement that returns the entire list x. Like this:

def list_functions(x):
  # Modify the single element here
  # Return the entire list here

FAQ: Learn Python - Lists and Functions - Modifying an element of a list in a function