The instructions are: " Find the grade value in your gradebook for your poetry class and use the .remove() method to delete it."
My code: gradebook.remove(gradebook[2]) ← current code, as suggested.
This removes both items inside the square brackets. It’s easy enough to replace them but the instructions seem to suggest removing only the second item - the “grade value.” I’ve searched and tried to remove, delete and pop but get errors. The suggested code has me removing the entire thing.
gradebook[2] is a list. The above line could be expected to remove the entire item from the grade book, not just the value, 85, as the instruction suggests.
Since we know that gradebook[2] is in fact a list, then we can use the .remove() method that it has to remove the value suggested.
This time the .remove() method is in the execution context of a[1].
Each object has its own attributes, and each method is in the context of the object. Methods are not global functions, but tied directly to the object that owns them.