Closed ambethia closed 9 years ago
I thought I closed this on Friday? 5 done, will try to do the bonus if time allows. https://github.com/cateia97/green_eggs_and_ham
Looks great. Your implementation of longest_word
doesn't actually look for the longest word though, you just kind of give that one response ("Sam-I-am"). Checkout max_by
Week 3 - Assignment 4
Description
This assignment serves to reinforce Ruby syntax and usage of blocks and enumerable with arrays and hashes. You'll also dabble in String manipulation.
After completing this assignment, you should:
Enumerable
like:map
,select
,reject
,max_by
andsort
.Array
like:uniq
andeach
.String
like:split
,lines
andgsub
.observr
to automatically run your tests.Details
cd
into your cloned repo,bundle install
and runobservr test/observr
to get started.skip
from the next test.test/test_green_eggs_and_ham.rb
.Bonus
Hints
The some of the tests expect words to be lowercase, but not all of the words in the text are lower case. Some of the words also end in punctuation that should be excluded when checking for unique words, i.e. "Sam-I-am!", "Sam-I-am", and "sam-i-am" should all be considered the same word.
Here's how to normalize them:
We'll talk about Regular Expressions soon, that's what the
/[^a-z-]/
is (it matches all characters that are not "a" through "z" or "-"). Feel free to research if you want, but this is a freebie.Resources