Question: Python Programming : Write a Function in python named (get_rank), that gets two arguments : a dictionary and an integer n this Function should be
Python Programming :
Write a Function in python named (get_rank), that gets two arguments : a dictionary and an integer n
this Function should be able to get the n keys with the most highest values in the dictionary, then return : key and its value
Examples :
my_dictionary = {'a': 4, 'b': 2, 'c': 2, 'd': 1, 'e': 1, 'f': 3, 'g': 1}
________________________
# call get_rank 1st time :
get_rank(my_dictionary, 4)
output :
a has 4
f has 3
b has 2
c has 2
______________________________
# call get_rank 2nd time :
get_rank(my_dictionary, 2)
output :
a has 4
f has 3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
