Input
{'laptop': 30000, 'file': 50}
Solution output
file
Expected output
file: 50
Input
{'mobile1':10000, 'mobile2':11000, 'mobile3':13000, 'mobile4':9000, 'mobile5':15000, 'mobile6':16000, 'mobile7':17000, 'mobile8':18000, 'mobile9':19000}
Solution output
mobile4
Expected output
mobile4: 9000
My Wrong Code:
#take input here
#input has been taken for you
import ast
import operator
input_str = input()
#input dictionary has been received in input_dict
input_dict = ast.literal_eval(input_str)
#start writing your code here
final_list=[]
#print(min(input_dict.items(), key=operator.itemgetter(1))[0])
#Cheapest = min(input_dict.items(), key=lambda i: i[1])
#Cheapest = min(input_dict, key=input_dict.get,values=input_dict.get )
Cheapest = min(input_dict, key=input_dict.get)
#print('Cheapest: {}'.format(Cheapest[input_dict]))
print(Cheapest )
#input_dict.get('Label','NA')
# list out keys and values separately
#key_list = list(my_dict.keys())
#val_list = list(my_dict.values())
#print(key_list[val_list.index(100)])
#print(key_list[val_list.index(112)])
#print(list(input_dict.keys())[list(input_dict.values()).index(9000)])
Any one correct my code. Thanks in advance