Practice

Your grade for your computer science class just came in! You got a perfect score, 100!

Use the .append() method to add a list with the values of "computer science" and an associated grade value of 100 to our two-dimensional list of gradebook.

I can’t seem to figure out how to do this question for the project I attempted but it wasn’t right, anyone know what to do

maybe
something like
gradebook.append( ["computer science", 100] )
if you have to append a list containing the class (string) and grade (integer)

Check the documentation too:

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

thank you for helping out

it doesnt look like that works this is what error im receiving
Traceback (most recent call last):
File “script.py”, line 13, in
gradebook.append (“computer science”, 100)
AttributeError: ‘tuple’ object has no attribute ‘append’

maybe make gradebook a list first, and then append to it:
gradebook = list(gradebook).append( ["computer science", 100] )

Or, maybe gradebook should be a list, so there should be a [ at the beginning and a ] at the end of it.

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