Menu
Coddy logo textTech

Recap - Frequency Counter

Part of the Logic & Flow section of Coddy's Python journey — lesson 16 of 78.

challenge icon

Challenge

Easy

Create a function named frequency_counter that takes a list data_list as an argument. The function should count the frequency of each item in the list and return a dictionary where the keys are the unique items from the list and the values are the counts of how many times each item appears.

For example, if the input list is [1, 2, 2, 3, 3, 3, 4, 4, 4, 4], the function should return a dictionary like this:

{1: 1, 2: 2, 3: 3, 4: 4}

Try it yourself

def frequency_counter(data_list):
    # Write code here

All lessons in Logic & Flow