- 1
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+=____
3 Antworten
+ 1
No idea?
h = {a:2, b:8, c:73}
sum = 0
h.each do |k, v|
sum+=v
+ 1
Thank you