Answer to Question #311049 in Python for Ram

Question #311049

Given an dictionary with key as person name,value as salary.write a program to find person with minimum salary.print person name aloo with salary.



input:


{sairam:1000,jack:2000,


sa i r am:200,raina:2500}


Output:


sairam ,1200



Input:


{jack:100,roy:500,j ack:300}



Output


Jack , 400



1
Expert's answer
2022-03-14T02:37:52-0400
def FindMinSalary(personsNameSalary):
    sortedByvalues=dict(sorted(personsNameSalary.items(), key=lambda item: item[1]))
    return next(iter((sortedByvalues.items())) )




personsNameSalary = {"sairam":1000,"jack":2000,"sairam":200,"raina":2500}
pair=FindMinSalary(personsNameSalary)
print(f"{pair[0]},{pair[1]}")
personsNameSalary = {"jack":100,"roy":500,"jack":300}
pair=FindMinSalary(personsNameSalary)
print(f"{pair[0]},{pair[1]}")

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS