我想从哈希表中获取最大值,但我一直得到的是第一个。
Crypto_name = ["Bitcoin", "Ethereum", "Project-x", "Fake"]
Crypto_price = ["$5500.6", "$538.9", "$0.25", "$46000.09"]
$crypto = Crypto_name.zip(Crypto_price).to_h
def largest_hash_key
puts $crypto.max_by{|a,b| b.to_i}
end
largest_hash_key