Advertisement
Guest User

Untitled

a guest
May 27th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. # require 'pry'
  2. def character_counting(characters)
  3. result = Hash.new(0)
  4. characters.delete(' ').chars.map do |change_to_one_big_array|
  5. # binding.pry
  6. change_to_one_big_array.split("").map {|count_the_letters| result[count_the_letters] += 1}
  7. end
  8. result
  9. end
  10.  
  11. puts character_counting("lighthouse in the house...")
  12.  
  13. #chars is the best
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement