Learn Python 3 - Gradebook Project - Question 8 (removing a value in a list)

https://www.codecademy.com/courses/learn-python-3/projects/python-gradebook

#8 You decided to switch from a numerical grade value to a Pass/Fail option for your poetry class. Find the grade value in your gradebook for your poetry class and use the .remove() method to delete it.

My code thus far is:

last_semester_gradebook = [["politics", 80], ["latin", 96], ["dance", 97], ["architecture", 65]] # Your code below: subjects = ["physics", "calculus", "poetry", "history"] grades = [98, 97, 85, 88] combined = [ ["physics", 98], ["calculus", 97], ["poetry", 85], ["history", 88] ] combined.append(["computer science", 100]) combined.append(["visual arts", 93]) gradebook = combined gradebook[-1][1] = 98 combined.remove([2][1]) print(gradebook)

The code prints fine when line 21 is not there. However, I’ve attempted to do a few variations of line 21 and can’t figure out how to remove the poetry grade (outside of just straight up deleting it from the code).

I saw a post from last year of a similar question where responders hand mentioned something about “zips” and “tuples”. We haven’t covered what those are yet so I don’t believe they want us to keep that in mind.

Thanks in advanced everyone!

this is the issue:
combined.remove([2][1])

You’re using .remove() incorrectly. It only takes one element as a parameter.

See:
https://docs.python.org/3/tutorial/datastructures.html

Thanks so much Lisa!

I did some more playing around with it and found out in additional to only calling on one element as a parameter, I also needed to call on the first element at the beginning:

gradebook[2].remove(85)

Thanks again for the feedback, super helpful! Resolved

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.