Ruby hash- How to count the sum of all values in the hash? | SoloLearn: Learn to code for FREE!

0

Ruby hash- How to count the sum of all values in the hash?

Fill in the blanks to count the sum of all values in the hash. h = {a:2, b:8, c:73} sum = 0 h.___ do |k, v| sum+=____

5/11/2020 5:11:20 PM

Андрей Рыбаков

2 Answers

New Answer

+3

No idea? h = {a:2, b:8, c:73} sum = 0 h.each do |k, v| sum+=v

+1