Generation

generate functionSun, 13 Nov 2022

Multiply the values of a hash by the keys

def product(hash) hash.map { |k, v| k * v }.reduce(:+) end product({1 => 2, 3 => 4, 5 => 6})

Want to kickstart your project?Use the new AI Studio to create your code