I can't understand, how to complete Code Coach with dictionaries. I can't understand, how does .Keys work. Help me, please! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

I can't understand, how to complete Code Coach with dictionaries. I can't understand, how does .Keys work. Help me, please!

The program you are given defines a metals dictionary, where names are used as keys and their price for 1 gram as values. It takes the name and the price of 5th metal as input. Add the 5th pair to the dictionary and write code to output the message about the most expensive metal in the dictionary. Sample Input Rhodium 225 Sample Output The most expensive: Rhodium Hint The given int[] prices = metals.Values.ToArray() line creates an array with values of the dictionary. You should sort its elements, and the last element will be the largest. Then you should find a way to output the key that has that max value in the dictionary.

6th Feb 2021, 6:40 PM
FogyX
FogyX - avatar
3 Answers
+ 3
Dictionary have two elements in them Keys, who are unique and Values Have a look at the link below https://code.sololearn.com/c01sV8ggP6YR/?ref=app
6th Feb 2021, 8:39 PM
sneeze
sneeze - avatar
+ 2
https://code.sololearn.com/cNNVx2HKZDw3/#cs
9th Jan 2022, 9:14 AM
Denys Turovskiy
Denys Turovskiy - avatar
+ 1
Thanks!
7th Feb 2021, 3:17 AM
FogyX
FogyX - avatar