Answers for "find key from value dictionary python"

0

find value in dictionary python

k = {1:10,2:20,3:30,4:40}
#idea : print([5,6,7,8][[12,15,47,45].index(15)])
b = list(k.keys())[list(k.values()).index(20)] #find index of 20 => return 2
Posted by: Guest on September-10-2021
-1

how to get value from key dict in python

# Get a value from a dictionary in python from a key

# Create dictionary
dictionary = {1:"Bob", 2:"Alice", 3:"Jack"}

# Retrieve value from key 2
entry = dictionary[2]

# >>> entry
# Alice
Posted by: Guest on August-15-2020
-3

find key by value python

print(list(d.keys())[list(d.values()).index(990)])
Posted by: Guest on May-04-2020

Code answers related to "find key from value dictionary python"

Python Answers by Framework

Browse Popular Code Answers by Language