PyAr / PyZombis

Programación Python para Zombis MOOC (código y materiales del curso abierto y masivo en linea)
GNU Affero General Public License v3.0
22 stars 48 forks source link

Added Wordcount Exercise Solution #294

Open ahyaanhassan opened 11 months ago

ahyaanhassan commented 11 months ago

Description:

Changes Made: I have added a Python solution for the "Wordcount" exercise, which includes three functions: print_words(), print_top(), and a helper function build_word_count_dict(). These functions allow users to analyze a text file and either print all words and their counts or print the top 20 most common words with their counts.

How to Use: print_words(filename): Prints all words and their counts in sorted order. print_top(filename): Prints the top 20 most common words and their counts in descending order.

Testing: I have tested the code with various sample inputs and it produces the expected results.

Contributor Agreement: By submitting this pull request, I confirm that I have read and agreed to the contributor agreement for this repository.