New student

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

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)


gradebook.remove [2] [1]


Hi there. I am getting an error on gradebook.remove [2] [1]
error: Traceback (most recent call last):
File “”, line 12, in
gradebook.remove ([2][1])
IndexError: list index out of range

I appreciate your help. I am trying to remove the 85 from poetry.


Thank you for your guidance.

Hi welcome to the forums :slight_smile:

Please see this post about formatting future posts as it helps get proper feedback for yourself: [How to] Format code in posts

The error is IndexError: list index out of range. If in doubt over the size of a list, you can always print queries as to it’s size or a single index value that you are wondering about.

my_list = ["a","b", [1,2,3],"c"]
print(my_list[1]) #prints "b"
print(my_list[2]) #prints [1,2,3]
print(my_list[2][1]) #prints 2 (item at index-1 of index-2 in the original list)
print(my_list[4]) # IndexError: list index out of range
1 Like