Q. Write a Python program to find the highest 3 values in a dictionary.

 

Answer = 

 

dic = eval(input("Enter a dictionary :-"))
val = list( dic.values() )
val.sort()
print("Highest 3 values ",val[ - 1 : - 4 : - 1])

Output :-

Enter a dictionary :-{ "Portal":16, "Express":14, "Path":15, "Walla":10,"Python":19}
Highest 3 values  [19, 16, 15]

>>>


2 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

  1. Nothing is helping. please update with a more relevant code. can't get it through

    ReplyDelete
    Replies
    1. Code is correct please try to understand by Output.

      Delete

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post