このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
ご挨拶
- Python はあなたの指示に従って、1行ずつ実行していきます。
- ここでコードを書いて実行できます。インストールは不要です。
- 各手順を読み、次へ を押してください。
print でテキストを表示
print(...)は画面にテキストを表示します。- テキストをクォートで囲んでください:
"..."。 - 各
printは新しい行を開始します。
English
print("Welcome to Python!")
print("This line runs next.")
ストリング(文字列)
- クォートで囲まれたテキストをストリングと呼びます。
- 二重引用符
"..."または一重引用符'...'を使えます。 - クォートなしの数値も印刷できます。例:
print(42)。
コメント
#で始まる行はコメントです。- Python はコメントを無視します(実行されません)。
- コードを読む人のためのメモを残すために使います。
English
# This line is a note for people. Python skips it.
print("Comments do not show.")
よくあるミス
printはテキストをクォートで囲む必要があります:print("Hi")、print(Hi)のように単独では使えません。- Python は大文字・小文字を区別します:
Printとprintは異なります。
あなたも試してみよう
- 以下にいくつかのタスクがあります。コードを入力して実行 を押してください。
- 正解確認 を押して正解かどうかを確認してください。
探索
How a program runs
A program runs top to bottom, one statement at a time.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Use print(...) to make Python show the words Hello, world! exactly (same spelling, same punctuation).
実行ボタンをクリックして出力を確認してください。
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Print 2つ lines. The first line must be My name is Pat. The second line must be I am learning Python. (Use two print(...) calls.)
実行ボタンをクリックして出力を確認してください。
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Keep the comment line, then print the number 42. Notice the comment never appears in the output.
実行ボタンをクリックして出力を確認してください。
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Print a box made of three lines: first +-----+, then | Hi! |, then +-----+ again.
実行ボタンをクリックして出力を確認してください。