Skip to content

Instantly share code, notes, and snippets.

@pjaspers
Created September 11, 2019 09:00
Show Gist options
  • Save pjaspers/6ee019e9aa772c7a4244ce21f7bb684a to your computer and use it in GitHub Desktop.
Save pjaspers/6ee019e9aa772c7a4244ce21f7bb684a to your computer and use it in GitHub Desktop.
Participants:	4,235,181
Books Pledged:	259,817,439
Books Finished:	56,102,660
Avg. Books Pledged:	61
Challenges Completed:	696,889
cleaned = blurb.lines.inject({}) do |result, line|
key, value = line.strip.split(":")
result[key.downcase] = value.strip.gsub(",", "").to_f
result
end

procent = (100/(cleaned["participants"] / cleaned["challenges completed"].to_f)).round(2)
puts "#{procent}% finished their challenge"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment