P13PythonBeginnerCalculate8 min

Count Frequency of Categories

Create a frequency table for survey responses without assuming every category is present.

#dictionaries#frequency#categorical-data

Scenario

A product survey export contains response labels such as satisfied, neutral, and dissatisfied.

Problem statement

Count each response and return a dictionary ordered by the original processing logic.

Your Task

  1. Choose an appropriate accumulator.
  2. Handle a category appearing for the first time.
  3. Explain how the result helps data-quality review.

Input

responses = ['satisfied', 'neutral', 'satisfied', 'dissatisfied', 'neutral']

Related Concepts

DictionariesCategorical variablesData validation

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.