Stuck with Gradebook

Can’t remove “poetry” using .remove

last_semester_gradebook = [[“politics”, 80], [“latin”, 96], [“dance”, 97], [“architecture”, 65]]

Your code below:

subjects = [“physics”, “calculus”, “poetry”, “history”]

grades = [98, 97, 85, 88]

gradebook = [[“physics”, 98], [“calculus”, 97], [“poetry”, 85], [“history”, 88]]


gradebook.append ([“computer science”, 100])

gradebook.append ([“visual arts”, 93])

gradebook[-1][-1] = 98


post your code with 3 triple backticks, ``` ,at the start and end for better presentation


This is the issue right here:

You’re missing something.

Yes, when I write:
it shows an error

I can delete it only with
gradebook.remove([“poetry”, 85])

You didn’t specify an index in gradebook and the .remove() method isn’t being used correctly.

How it should be written?

Did you look at the hint by any chance?

You’re removing an item from a sublist…So, you can’t just pass (85) through as an argument. You have to identify the index of the sublist first.

If you just had a list, then yes, this would work:

grades = [99, 85, 76, 49]

But, you have a list inside a list.

Thank you, everything is okay now

1 Like