On the (recently updated) new version of Python Loops in the Computer Science Career Path, the lessons teach that a 2D list should be put in brackets within brackets [["Like", "This"], ["List", "Here"]]
. However, on the Python Gradebook project, the last semester gradebook is written (and prints) as follows:
last_semester_gradebook = [("politics", 80), ("latin", 96), ("dance", 97), ("architecture", 65)]
In the same project, the user creates a 2D list, with the hint reiterating what was said in the lesson: that it should all be bracketed.
Is last_semester_gradebook
not really a 2D list? Are parentheses a valid way of formatting 2D lists? Why are we able to add lists with parentheses and brackets together and still have them work? Is this a preference issue, or a Python 3 issue, or something else entirely?
I Googled for a while, but couldn’t find anything that wasn’t about NumPy, which I don’t yet know anything about, and the answers weren’t particularly enlightening.