xxxxxxxxxx
# creating a new dictionary
my_dict ={"Java":100, "Python":112, "C":11}
# one-liner
print("One line Code Key value: ", list(my_dict.keys())
[list(my_dict.values()).index(100)])
xxxxxxxxxx
d = {'key1': 'aaa', 'key2': 'aaa', 'key3': 'bbb'}
keys = [k for k, v in d.items() if v == 'aaa']
print(keys)
# ['key1', 'key2']
keys = [k for k, v in d.items() if v == 'bbb']
print(keys)
# ['key3']
keys = [k for k, v in d.items() if v == 'xxx']
print(keys)
# []