ezoic

Monday, March 13, 2017

Python problem 9

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

class Solution:
    def high3(self,dic1):
        list1=[]
        for value in dic1.values():
            list1.append(value)

        a=sorted(list1,reverse=True)[:3]

        return(a)

kk=Solution()

if __name__=="__main__":

    print(kk.high3({"a":6,"l":8,"o":5,"i":2,"t":4}))

No comments:

Post a Comment

looking for a man

 I am a mid aged woman.  I was born in 1980. I do not have any kid. no complicated  dating before . I am looking for a man here for marriage...