Why do you need double Parenthesis when appending to a list

Learning Python 3
Python Gradebook exercise

I am just wondering why you need to have double parenthesis when appending to a more than one value at a time.

example: gradebook.append((‘visual arts’, 93))

When I append without the double parenthesis, I get:
TypeError: append() takes exactly one argument (2 given)

I get what the error is saying, I just don’t understand why adding the extra parenthesis around the values I’m trying to pass to the list solves the problem.

Thanks ahead of time for the explanation

3 Likes

the append method can only append one item at a time, by using using an additional set of parentheses you append one tuple (tuple is an immutable list)

if you want to add multiple elements at once, use list extending:

lst = [1, 2, 3,]
lst += [4, 5, 6]
print(lst)
3 Likes