Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python find smallest element in dictionary

d = {"A":3, "B":1, "C":100}

# find key with lowest value
best_key = min(d, key=d.get)

print(best_key)
# output: B
 
PREVIOUS NEXT
Tagged: #python #find #smallest #element #dictionary
ADD COMMENT
Topic
Name
6+4 =