Need help with the "Code Challenge:Lists


#1

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

https://www.codecademy.com/paths/computer-science/tracks/cspath-flow-data-iteration/modules/dspath-lists/lessons/python-functions-lists-cc/exercises/double-index

Don’t know what to do.


#2

Saw the solution but still no idea what to do.:roll_eyes::thinking::tired_face::sleeping:


#3

Break the problem down into simple steps, starting with a block:

def func_name (params):

    return

Follow that with a call so you can see that it matches the function name.

print (func_name(arguments))

If index is not a valid index, the function should return the original list.

So now we have a conditional and a possible return value.

    if index < len(list_param):
        # run the code
    return list_param

The function should double the value of the element at index of lst and return the new list with the doubled value.

        list_param[index] *= 2

Now just put it all together with the correct names on objects given in the instructions, along with the expected parameters and arguments.