Your first program
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
English
Welcome
- Python follows your instructions, one line at a time.
- You write code here and run it — nothing to install.
- Read each step, then press Continue.
日本語
ご挨拶
- Python はあなたの指示に従って、1行ずつ実行していきます。
- ここでコードを書いて実行できます。インストールは不要です。
- 各手順を読み、次へ を押してください。
English
Show text with print
print(...)shows text on the screen.- Put the text in quotes:
"...". - Each
printstarts a new line.
日本語
print でテキストを表示
print(...)は画面にテキストを表示します。- テキストをクォートで囲んでください:
"..."。 - 各
printは新しい行を開始します。
print("Welcome to Python!")
print("This line runs next.")
English
Strings
- Text in quotes is called a string.
- You can use double quotes
"..."or single quotes'...'. - You can also print a number with no quotes, like
print(42).
日本語
ストリング(文字列)
- クォートで囲まれたテキストをストリングと呼びます。
- 二重引用符
"..."または一重引用符'...'を使えます。 - クォートなしの数値も印刷できます。例:
print(42)。
English
Comments
- A line that starts with
#is a comment. - Python ignores comments — they do not run.
- Use them to leave notes for people who read your code.
日本語
コメント
#で始まる行はコメントです。- Python はコメントを無視します(実行されません)。
- コードを読む人のためのメモを残すために使います。
# This line is a note for people. Python skips it.
print("Comments do not show.")
English
Common mistakes
printneeds quotes around text:print("Hi"), notprint(Hi).- Python is case-sensitive:
Printis not the same asprint.
日本語
よくあるミス
printはテキストをクォートで囲む必要があります:print("Hi")、print(Hi)のように単独では使えません。- Python は大文字・小文字を区別します:
Printとprintは異なります。
English
Now you try
- Below are a few tasks. Type your code and press Run.
- Press Check answer to see if it is correct.
日本語
あなたも試してみよう
- 以下にいくつかのタスクがあります。コードを入力して実行 を押してください。
- 正解確認 を押して正解かどうかを確認してください。
Explore · 探索
How a program runs
A program runs top to bottom, one statement at a time.
Use print(...) to make Python show the words Hello, world! exactly (same spelling, same punctuation).
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
Print two lines. The first line must be My name is Pat. The second line must be I am learning Python. (Use two print(...) calls.)
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
Keep the comment line, then print the number 42. Notice the comment never appears in the output.
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。
Print a box made of three lines: first +-----+, then | Hi! |, then +-----+ again.
Click Run to see the output here. · 実行ボタンをクリックして出力を確認してください。