sample_dict = {
'Physics': 82,
'Math': 65,
'history': 75
}
def find_min_key(sample_dict):
min_num = ()
for item in sample_dict.items():
if not min_num: # Checking empty tuple condition
min_num = item
if min_num[1] > item[1]:
min_num = item
return min_num
min_num = find_min_key(sample_dict)
print(min_num[0])
Math
sample_dict = {'a': 100, 'b': 200, 'c': 300}
num_to_search = int(input('Enter a number to search in the dictionary'))
dict_values = sample_dict.values()
if num_to_search in dict_values:
print(f"{num_to_search} present in a dict")
else:
print(f"{num_to_search} NOT present in a dict")
500 NOT present in a dict
dict1 = {'Ten': 10, 'Twenty': 20, 'Thirty': 30}
dict2 = {'Thirty': 30, 'Fourty': 40, 'Fifty': 50}
dict1.update(dict2)
dict1
{'Ten': 10, 'Twenty': 20, 'Thirty': 30, 'Fourty': 40, 'Fifty': 50}