Night 3: Talk to your pet
You already finished this night, in Python or pseudocode. It counts for both. Practise again if you like.
このページには最新のブラウザ(SharedArrayBuffer対応)が必要です。Chrome、Edge、Firefox、Safariを最新バージョンに更新してください。
English
Tonight: talk to your pet
- Your pet has a name. Now it wants to know your name.
- You will learn one thing:
INPUT.
Words for tonight
| Word | Meaning |
|---|---|
| input | what the user types into the program |
| user | the person who uses the program |
| wait | stop and do nothing until something happens |
English
INPUT waits for the user
INPUT Namestops the program and waits.- The user types something and presses Enter.
- The typed words go into the variable
Name. Declare it first.
DECLARE Name : STRING
OUTPUT "What is your name?"
INPUT Name
OUTPUT "Hello, ", Name
- Press Run. A box opens. Type your name and press Enter.

English
Never type the answer yourself
- Do not write
Name ← "Sam". Then the program always says Sam. INPUTlets every user give a different answer.- The checker types different names to test your program.
English
Ask, wait, answer
- Many programs work like this:
-
- Ask a question with
OUTPUT.
- Ask a question with
-
- Wait for the answer with
INPUT.
- Wait for the answer with
-
- Answer with
OUTPUT, using the variable.
- Answer with
DECLARE Food : STRING
OUTPUT "What is your favourite food?"
INPUT Food
OUTPUT "Yum! ", Food, " is great!"
English
Now you try
- Do the tasks below. Press Run and type an answer.
- Then press Check answer. The checker types some answers for you.
難易度 1/5 · 100 コイン + 今日初回達成時の小ボーナス
Your pet asks your name. Read it with INPUT Name. Then output Nice to meet you, and the name. For the name Sam, the output is Nice to meet you, Sam.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Your pet asks: What colour? Read the answer into Colour. Then output I will paint my house and the colour. For blue, the last line is I will paint my house blue.
実行ボタンをクリックして出力を確認してください。
難易度 2/5 · 140 コイン + 今日初回達成時の小ボーナス
Read 2つ answers with two INPUT lines: first a name into Name, then a city into City. Then output one line like Sam lives in Ningbo.
実行ボタンをクリックして出力を確認してください。