Why in this lesson is it apparently possible to add 2 elements at once using .append function?




the solution to the exercise number 6 is the following:

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

Why in this case is it possible to add 2 things, a string and a number?

Thank you.


Hi @ai-2090,

It is actually a single object that is a tuple containing two elements. A list can contain any type of object, including simple int or float objects, lists, tuples, instances of user-defined classes, or functions. In fact, a list can even contain a reference to itself, but be careful if you create one of those.


So it’s a ‘‘tuple’’, haven’t heard of it before, that’s why I was confused.

Thank you very much.