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
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]}")
Comments
Leave a comment