Project Level 2: Intermediate
This project is designed for intermediate learners who know Python fundamentals and are practicing building complete programs.
Project Description
Write a program that takes a list of words and finds the most frequently occurring one. Start by writing this list in the first line of your program:
words = ["love", "peace", "joy", "love", "happiness", "love", "joy"]
Expected Output
Your program should find the most frequent word and print out a message similar to the following where the most frequent word (i.e., “love“) is is mentioned.
Learning Benefits
List Processing: Work with lists containing text data.
Using Collections (Optional): Learn how the
Counter
class simplifies frequency counting.Efficient Lookups: Extract the most common element in a single step.
Prerequisites
Required Libraries: No libraries are needed for this project.
Required Files: No files are needed for this project.
IDE: You can use any IDE on your computer to code the project.
Danger Zone
We provide two solutions for this problem. In one we use the Counter class from the collections module and in the other we use a combination of the for-loop and the max function.