Workout #20: Word Count

Oct 5, 2021

The challenge for this exercise is to write a wordcount function that mimics the wc Unix command. The function will take a filename as input and will print four lines of output:

  • Number of characters (including whitespace)
  • Number of words (separated by whitespace)
  • Number of lines
  • Number of unique words (case sensitive, so “NO” is different from “no”)

TRY IT YOURSELF

ANSWER

https://colab.research.google.com/drive/1uj5DrbH4tbkxLzEEwNz71PHoNLgwyY7g?usp=sharing

--

--

Abish Pius
Abish Pius

Written by Abish Pius

Data Science Professional, Python Enthusiast, turned LLM Engineer

No responses yet