Hashes • Exercise 3/4

Count Words

00:00
0
20 points

Instructions

Create a function count_words that takes a string and returns
a hash with each word as a key and its count as the value.

  • Convert words to lowercase
  • Split on spaces

Example: count_words("hello world hello") returns {"hello" => 2, "world" => 1}

Your Code

Results

Click "Run Tests" to see results