Skip to content

Instantly share code, notes, and snippets.

@MarceloAlves
Created October 31, 2014 23:53
Show Gist options
  • Save MarceloAlves/7dde2803740a2a8464aa to your computer and use it in GitHub Desktop.
Save MarceloAlves/7dde2803740a2a8464aa to your computer and use it in GitHub Desktop.
require 'open-uri'
list = open('https://gist.githubusercontent.com/coderd00d/54215798871d0c356cfb/raw/5eaeefb59a46bbede467bc3d1ce58f5462f78166/186%20easy').read
candy = Hash.new{ |k,v| k[v] = 0 }
list.split(/\n/).each{ |v| candy[v] += 1 }
candy.each do |k,v|
p "#{k} - #{v} - #{format('%.2f%', v.to_f/1000 * 100)}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment