I’m a C# developer and just started getting into Data Science. It’s been a while since I’ve worked with Python so I’ll try my best to answer your questions.
You create a dictionary using the {} brackets. You create a list with [] brackets. These are different types of data structures with different behaviors.
At high level, what this logic is doing is performing a count of ratings and aggregating their totals in the content_ratings dictionary. We want to use content_ratings[rating] to access the rating’s value and aggregate it. The append method is not available for dictionaries.