Are parentheses and brackets interchangeable for nested lists? If so - how can we differentiate between Lists and Tuples?

In the context of this project about lists, a pre-written code features a nested list where the “external” list is surrounded by brackets, while the “internal” lists (if these are lists indeed) are surrounded by parentheses, as follows:

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

Similarly, the “Hint” feature for step 6 states the following example:

To add a value like this to the end of a list use:
nested_list.append((string_value, number_value))

So in this case:
gradebook.append((“visual arts”, 93))

So, my question is: are the “internal” lists observed in these examples lists indeed, or are they a different object (ex. Tuple)? If these are lists indeed - why are parentheses used, instead of brackets, and how/why are brackets and parenthesis interchangeable in this context? Similarly, how is one not to confuse lists with other collection types that do use parenthesis, such as Tuples?

(I have not encountered “Tuples” yet in this career path, and only have observed that such an object exists, and that it uses parentheses as opposed to brackets. Please consider concisely summarizing the difference between the two collection types, for the context presented)

(Computer Science Path, module 3 (Flow, Data, and Iteration), “Python Lists” Chapter, " “Python Gradebook” Project)

The fundamental difference between lists and tuples are immutable. Understanding the difference also means we now know when to use which

by using tuples you signal to other developers (or yourself later) that these tuples shouldn’t be mutated.

using the right data types at the right places really pays of when your program/code base starts to grow

3 Likes