# 딕셔너리

### 코드

```
{딕셔너리_이름} = {
 키: 값
}

{딕셔너리_이름} 보여주기
{딕셔너리_이름}["키"] 보여주기
```

***

### 설명

**딕셔너리(또는  사전)**&#xB294; 여러 개의 정보를 한 번에 묶어서 저장할 수 있는 자료형이에요.\
각 정보는 키(key)와 값(value) 한 쌍으로 이루어져 있어요.

이 예시에서는 한 학생의 정보를 딕셔너리 형태로 저장했어요.\
학년, 반, 번호, 진로와 같은 여러 정보를 하나의 변수에 담을 수 있어요.

딕셔너리 이름만 출력하면 저장된 모든 정보를 한 번에 확인할 수 있고,\
`["키"]` 문법을 사용하면 원하는 정보 하나만 꺼내서 볼 수 있어요.

***

### 주의사항

* 키 이름은 정확하게 입력해야 해요.
* 딕셔너리에 없는 키를 사용하면 값을 가져올 수 없어요.

***

### 파이썬 대응 코드

```
딕셔너리_이름 = { 키1: 값1, 키2: 값2, 키3: 값3 }
```

***

### 예시

{% code title="예시 코드" %}

```
예시
학생 = {
    학년: 6
    반: 3
    번호: 14
    진로: "개발자"
}
​
학생 보여주기
학생["학년"] 보여주기
학생["반"] 보여주기
학생["번호"] 보여주기
학생["진로"] 보여주기
```

{% endcode %}

{% code title="예시 코드의 출력" %}

```
{
    학년: 6
    반: 3
    번호: 14
    진로: "개발자"
}
6
3
14
개발자
```

{% endcode %}

***

### 검색 키워드

딕셔너리, 자료형, 키와 값, 데이터 저장, 값 종류


---

# 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://codebook.horang.it/readme/undefined.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.
