# 문장(Statement)

C, Java는 문장의 끝을 ";"로 표시했습니다. 이것을 통해서 하나의 명령이 종료됨을 표시하였습니다. 반면 Python은 문장의 끝을 표시하지 않습니다. 보통 한 줄에 하나의 명령만을 수행하는 것으로 인식됩니다.

```python
num = 100
print(num)

num1 = 21; num2 = 22; print(num1+num2)

sum = num1 + num2 + \
    23 + 24 + 25 + \
    26 + 27
print(sum)

sum2 = (num1 + num2 +
    23 + 24 + 25 +
    26 + 27 )
print(sum2)

animal = ["Rabbit",
        "Monkeyu",
        "Horse"]
print(animal)
```

1행과 2행의 사용법은 가장 기본적인 사용법입니다. 그러나, 4행에 보면 조금 특입합니다. 이 방법은 앞의 내용과 다릅니다. ";"를 사용하여 한 행에서 3가지의 동작을 수행합니다. num1에는 21을 num2에는 22를 대입한 후에 그합을 출력하는 내용입니다. 실제 사용할 일은 별로 없겠으나, 이렇게 사용할 수 있다는 것만 기억해 둡시다.

6부터 8행 또는 11 부터 13행은 한 줄로 표시하지 않고 여러 줄로 하나의 동작을 표시하는 내용입니다. 위와 같은 간단한 예제는 문제가 되지 않지만 복잡한 함수를 사용하거나 사용하는 변수의 이름이 길 경우에는 한 줄로 표시하는 것이 가독성이 떨어지는 경우가 있습니다. 이 경우에 위와 같은 방법으로 쓸 수 있다는 점을 기억하시기 바랍니다.

## 예제

앞 페이지의 문자열 출력 방법과 문장 사용법을 이용하여 윤동주의 서시(序詩)를 입력하여 출력해 봅시다. 시에 있는 모든 문장 기호 및 빈 줄까지도 모두 표시하도록 합니다. 윤동주의 서시는 다음의 홈페이지를 참고합니다. [https://ko.wikisource.org/wiki/하늘과\_바람과\_별과\_시/서시](https://ko.wikisource.org/wiki/%ED%95%98%EB%8A%98%EA%B3%BC_%EB%B0%94%EB%9E%8C%EA%B3%BC_%EB%B3%84%EA%B3%BC_%EC%8B%9C/%EC%84%9C%EC%8B%9C)


---

# 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://study-code.gitbook.io/python-basic/undefined/statement.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.
