이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Two kinds of number
- An integer (
int) is a whole number, like7or-3. - A float is a number with a decimal point, like
2.5. - Division with
/always gives a float, even4 / 2→2.0.
English
Add, subtract, multiply, divide
+adds,-subtracts,*multiplies,/divides.- You can use them with variables or with plain numbers.
- Spaces around operators are optional but make code easier to read.

English
print(7 + 2)
print(7 - 2)
print(7 * 2)
print(7 / 2)
English
Whole-number division, remainder, powers
//divides and rounds down to a whole number (floor division):7 // 2is3, and-7 // 2is-4.%gives the remainder (called modulo).**raises to a power:2 ** 3is 2×2×2.
English
print(7 // 2)
print(7 % 2)
print(2 ** 5)
English
Order of operations
- Python does
**first, then*///%, then+-. - This is the same order you use in maths.
- Use parentheses
(...)to change the order.
English
print(2 + 3 * 4)
print((2 + 3) * 4)
English
Common mistakes
/always gives a float (4 / 2is2.0); use//when you want a whole number.- Power is
**, not^. "3" + "4"joins text into"34"— it does not add to7.
English
Now you try
- Store each answer in the variable named in the task.
- Press Check answer to test your code.
탐색하기
연산 우선순위
Python은 ×와 ÷를 +와 −보다 먼저 계산하며, 왼쪽에서 오른쪽으로 진행합니다.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
length에 8, width에 5을 할당하십시오. 그 다음 두 값의 곱을 area라는 변수에 저장하십시오.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
17개의 사탕을 5명의 아이들에게 나누어 주십시오. 각 아이가 받는 개수는 each에 (// 사용), 남는 개수는 left에 (% 사용) 저장하십시오.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
3 ** 2 + 1를 result에 저장하십시오. 그다음 괄호를 사용하여 (3 + 1) ** 2를 grouped에 저장하십시오.
출력을 보려면 '실행'을 클릭하세요.
난이도 1/5 · 100코인 + 오늘 첫 완료 시 작은 보너스 추가
celsius는 37입니다. celsius × 9 ÷ 5 + 32 공식을 사용하여 페렌하이트 온도를 fahrenheit에 저장하십시오.
출력을 보려면 '실행'을 클릭하세요.