Code Challenge, Loops: Same Values

Directions: "Write a function named same_values() that takes two lists of numbers of equal size as parameters.

The function should return a list of the indices where the values were equal in lst1 and lst2 .

For example, the following code should return [0, 2, 3]."

I’m returning ‘None’ with this code, says I should be returning [0, 2, 3]

Any help is greatly appreciated! Thank you!!

Try the following code and consider what happens when you call the .append() method?

original_list = [0, 1, 2]
append_return = original_list.apppend(3)
print(append_return)
print(original_list)

It’s also worth noting that a for loop has it’s own code block and it will execute all iterations of that loop before moving on to the next statement. Perhaps using the index can help here.

I suggest that for each and every operation you carry out, print out what values you have before it, and then afterwards print out the thing you accomplished with that operation. You should be able to see the effects of every single step you carry out. Ideally you would do this while you write the code, so you would decide what should happen next, print out the things you need, write code for the operation, and print out the result, and check that this is really the result you wanted before you move on with the next thing whatever that is, and repeat the process for that.

You can consider what such output would look like if you manually wrote down all the actions carried out.
presumably you would visit each valid index in order, and during each such visit find out what the two values are, so you’d print those, and then you’d compare them, so you’d print out the result of the comparison, and if it is decided the index should be kept, you might print out the current list of indices, then add the new index, the print out the indices again so that you can see that it did indeed get added… then the would follow similar output for the rest of the visited indices