# 获取字典最大最小值

代码：

```python
price={
    '小米':899,
    '三星':3999,
    '华为':1999,
    '苹果':5000
}

print(min(price)) #明显不对，因为是以key为判断的，需要反转key,value的关系
print(min(zip(price.values(),price.keys())))
print(max(zip(price.values(),price.keys())))

print(min(zip(price.values(),price.keys()))[1])
print(max(zip(price.values(),price.keys()))[1])
```

结果：

```python
三星
(899, '小米')
(5000, '苹果')
小米
苹果
```

视频：

```
wait
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://im-qianuxn.gitbook.io/pytorch/ji-suan-ji/python/2.3.5-huo-qu-zi-dian-zui-da-zui-xiao-zhi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
