Skip to content

Instantly share code, notes, and snippets.

@DonMat
Created October 27, 2017 09:35
Show Gist options
  • Save DonMat/2ad2536dd3eb7813dd71819e501e480c to your computer and use it in GitHub Desktop.
Save DonMat/2ad2536dd3eb7813dd71819e501e480c to your computer and use it in GitHub Desktop.
Infakt_workshops_challenge_1
def passed_or_failed(hash, threshold)
result = {}
result[:passed] = hash.select{|k,v| v.to_i >= threshold.to_i}
result[:failed] = hash.select{|k,v| v.to_i < threshold.to_i}
result
end
hash = {"Mark" => 10, "Ellen" => 65, "Roger" => 20, "Mike" => "70"}
puts passed_or_failed(hash, "65")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment