Question about Analyzing Shakespeare

Continuing the discussion from New trail: Ruby Challenges:

I think the root issue is that you’re not sure how each_with_object works. That’s okay, by the way :smile:.

Let’s simplify the example a little bit. I’m going to give you a simpler challenge that I think will help you understand things.

Write a method that takes an array of strings and returns a hash where the keys are the strings, and the values are their lengths.


def strings_to_lengths(strings)
  # You write this part. Use each_with_object.

# Expected results:
strings = ["ben", "eric", "nathan"]
strings_to_lengths(strings) # Returns: { "ben" => 3, "eric" => 4, "nathan" => 6 } 

I think when you solve this, you’ll be well on your way to understanding how your more-complicated example works.

1 Like

I moved 3 posts to an existing topic: Ruby Challenges - Analyzing Shakespeare

This topic is now unlisted. It will no longer be displayed in any topic lists. The only way to access this topic is via direct link.

Hi, this is my first attempt at Upcase and I’m struggling to push the repo. I am doing…

git push origin master

However I am getting the following error:

remote: error: insufficient permission for adding an object to repository database objects
remote: fatal: failed to write object
error: unpack failed: unpack-objects abnormal exit
! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to ‘’

Any help would be great