How to find a key by its value in a Dictionary Python

Posted on: January 24th, 2023
By: Tadeo Martinez

Here’s a good article where I found several solutions:

The one below is the one that made sense for me.

my_dict ={"java":100, "python":112, "c":11}
# list out keys and values separately
key_list = list(my_dict.keys())
val_list = list(my_dict.values())
# print key with val 100
position = val_list.index(100)

Have any questions or comments? Write them below!

Leave a Reply

Your email address will not be published. Required fields are marked *