Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Dictionary
- def entries
- @english = {}
- end
- # Then, you should be
- # able to add words and their definition
- #by calling a method and passing in a hash as an argument
- def add(new_hash)
- @english.merge(new_hash)
- end
- end
- #You should also be able to list all of the words and
- #their definitions in another method
- def entries
- @english
- end
- #Finally, you should be able to search the dictionary
- #by passing in the first few letters of a word
- def search
- end
- end
- my_dict = Dictionary.new
- my_dict.add('first' => 'thing1')
- my_dict.add('second' => 'thing2')
Add Comment
Please, Sign In to add comment