Sequence, input & output · 순서, 입력 및 출력
A program runs in order
- A program is a list of steps.
- Python runs them from top to bottom, one at a time.
- This order is called sequence — the first idea in the syllabus.
프로그램은 순서대로 실행됩니다
- 프로그램은 단계들의 목록입니다.
- Python은 위에서 아래로 한 번에 하나씩 실행합니다.
- 이 순서를 **순서(Sequence)**라고 하며,这是对 syllabus의 첫 번째 개념입니다.
print("Wake up")
print("Brush teeth")
print("Go to school")
OUTPUT becomes print()
- In the exam, OUTPUT shows something on the screen.
- In Python, that is
print(). - The text inside the quotes is printed, then a new line starts.
OUTPUT이 print()가 됩니다
- 시험에서 OUTPUT은 화면에 무언가를 표시함을 의미합니다.
- Python에서는 이것이 **
print()**입니다. - 따옴표 안의 텍스트가 출력되고, 새 줄이 시작됩니다.
print("Hello, world!")
print("IGCSE Computer Science")
INPUT becomes input()
- In the exam, INPUT reads what the user types.
- In Python, that is
input(). - It always gives back a string (text), even if the user types digits.
INPUT이 input()이 됩니다
- 시험에서 INPUT은 사용자가 입력한 내용을 읽습니다.
- Python에서는 이것이 **
input()**입니다. - 사용자가 숫자를 입력하더라도 항상 문자열(string) 을 반환합니다.
name = input()
print("Hello, " + name)
Turn input into a number
input()gives text, so"5"is not the number 5.- Wrap it with
int()to get a whole number. - Now you can do maths with it.
입력을 숫자로 변환하기
input()은 텍스트를 제공하므로,"5"은 숫자 5가 아닙니다.- **
int()**으로 감싸면 정수를 얻을 수 있습니다. - 이제 수학 연산을 할 수 있습니다.
age = int(input())
print(age + 1)
In the exam: pseudocode
- The same idea in Cambridge pseudocode uses
INPUTandOUTPUT.
시험: 가짜코드(pseudocode)
- Cambridge 가짜코드에서는 같은 원리에
INPUT과OUTPUT을 사용합니다.
OUTPUT "What is your name?"
INPUT Name
OUTPUT "Hello, ", Name
Common mistakes
- Statements run from top to bottom, in the order you write them.
input()gives back text (a string); useint(...)when you need a number.
흔한 실수
- 문장은 작성한 순서대로 위에서부터 아래로 실행됩니다.
input()은 텍스트(문자열)를 반환하며, 숫자가 필요할 때는int(...)을 사용하세요.
Now you try
- Use
print()to show output. - Use
input()to read a line — leave the brackets empty here. - Press Check answer to test your code.
이제 직접 해보기
- 출력을 표시하려면
print()을 사용하세요. - 줄을 읽으려면
input()을 사용하세요 — 여기는 괄호를 비워둡니다. - Answer 확인 버튼을 눌러 코드를 테스트하세요.
Input → process → output · 입력 → 처리 → 출력
Most programs follow one shape: get input, do something, show output. · 대부분의 프로그램은 하나의 형태를 따릅니다: 입력 받기, 작업 수행, 출력 표시.
Print these three lines, in order: Ready, then Set, then Go — one per line. · 세 줄을 순서대로 출력하세요: 먼저 Ready, 그다음 Set, 그리고 Go — 줄마다 하나씩.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Read a name with input(), then print Hello, then the name then !. For the input Sam, the output should be Hello, Sam!. · input()으로 이름을 읽고, Hello, 을 출력한 후 이름과 !을 출력하세요. 입력 Sam에 대해 출력은 Hello, Sam!이어야 합니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
Read a whole number with input(), convert it with int(...), then print it doubled (times 2). For input 6, the output should be 12. · input()으로 정수를 읽고, int(...)으로 변환한 후 두 배(×2)로 출력하세요. 입력 6에 대해 출력은 12이어야 합니다.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.