Question: I have a dict of tuples such as: 

```
d = {'a': (3, 5), 'b': (5, 8), 'c': (9, 3)}  

```

I want to return the key of the minimum of the tuple values based on the tuple index. For example, if using tuple index = 0, then 'a' would be returned. if index = 1, then 'c' would be returned. I have tried using min(), for example 

```
min(d, key=d.get)

```

but am not sure how to manipulate it to select the tuple index to use. Although there are similar questions, I have not found an answer to this. Apologies in advance if this is a duped question, and please link to the answer. Thanks

Answer: 
You can write a lambda function to get the elements from the value by their index:

```
min(d, key=lambda k: d[k][0])
# 'a'
min(d, key=lambda k: d[k][1])
# 'c'

```
Dictionaries are unsorted and have no index. 

If you want the return the key alphabetically first you could use the ascii order:

```
print(chr(min([ord(key) for key in d.keys()])))

```