# 여러 줄 프롬프트

Amazon Q Developer는 사용자의 의도를 이해하고 여러 줄 프롬프트에서 지침을 기반으로 제안을 제공합니다. 지시문은 바람직한 결과를 확인하기 위해 프롬프트 내의 특정 키워드를 강조하는 데 도움이 될 수 있습니다.

***

## 예시 #1

### 문자열과 숫자

#### 일반적인 프롬프트

```bash
Given a list that contains some numbers and strings,
**CREATE** a function called `format_list` and
format the numbers in the list into a string in which the numbers are prepended with a "#"
and check for strings and wrap in a double quote.
```

#### Python 프롬프트

`prompt_eng.py` 라는 이름의 파일을 생성하고, 다음의 코드를 작성합니다.

```bash
"""
Given a list that contains some numbers and strings, 
CREATE a function called `format_list` and
format the numbers in the list into a string in which the numbers are prepended with a "#" 
and check for strings and wrap in a double quote.
"""
```

<details>

<summary>Amazon Q Developer 제안</summary>

```bash
def format_list(list):
    new_list = []
    for i in list:
        if type(i) == int:
            new_list.append("#" + str(i))
        else:
            new_list.append('"' + i + '"')
    return ", ".join(new_list)
```

</details>

## 예시 #2

### 함수 테스트

#### 일반적인 프롬프트

```bash
Test the format_list function
```

#### Python 프롬프트

같은 파일에서 다음의 코드를 작성합니다.

```bash
# Test the format_list function
```

<details>

<summary>Amazon Q Developer 제안</summary>

<pre class="language-bash"><code class="lang-bash"><strong>print(format_list([1, 2, 3, 4, 5, "six", "seven", 8, 9, 10]))
</strong></code></pre>

</details>

## 예시 #3

### 프롬프트 지시문

키워드를 더욱 강조하기 위한 “CREATE” 및 “MERGE”를 포함한 추가적인 명시적 지시문의 사용법이 아래에 나와 있습니다.

#### 일반적인 프롬프트

```bash
*CREATE* a list of TV shows. 
*CREATE* a list of ratings for these TV shows. 
*MERGE* them to make a json object of 10 shows and their ratings.
```

#### Python 프롬프트

같은 파일에서 다음의 코드를 작성합니다.

```bash
"""
CREATE a list of TV shows.
CREATE a list of ratings for these TV shows.
MERGE them to make a json object of 10 shows and their ratings.
"""
```

<details>

<summary>Amazon Q Developer 제안</summary>

```bash
import json

def create_tv_shows_list():
    tv_shows = ["Game of Thrones", "Breaking Bad", "The Walking Dead", "Stranger Things", "Sherlock", "The Office", "The Big Bang Theory", "The Simpsons", "Friends"]
    return tv_shows
def create_ratings_list():
    ratings = [9.5, 9.0, 8.5, 8.0, 8.5, 8.0, 8.5, 8.0, 8.5]
    return ratings
def merge_lists(tv_shows, ratings):
    merged_list = {}
    for i in range(len(tv_shows)):
        merged_list[tv_shows[i]] = ratings[i]
    return merged_list
```

</details>

## 예시 #4

### 업데이트 된 함수 테스트

#### 일반적인 프롬프트

```bash
Test the merge_lists function
```

#### Python 프롬프트

같은 파일에서 다음의 코드를 작성합니다.

```bash
# Test the merge_lists function
```

<details>

<summary>Amazon Q Developer 제안</summary>

```bash
tv_shows = create_tv_shows_list()
ratings = create_ratings_list()
merged_list = merge_lists(tv_shows, ratings)
print(json.dumps(merged_list, indent=4))
print(merged_list)
```

</details>


---

# 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://bangshinchul.gitbook.io/amazon-q/amazon-q-developer/undefined/undefined-4.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.
