CHAPTER 4

Talking Back 🗣️

So far, the computer only listens to you. But what if the Genie wants to ask YOU a question? 🤔

We use the input() spell! It makes the computer pause and wait for the human to type something.

✨ The Input Spell

1. The computer asks a question.
2. The human types an answer.
3. The answer gets saved into a variable.

user_name = input("What is your name?")
💡
When you run this code, a box will pop up! Type your answer there and click OK.

YOUR QUESTS ⚔️

Quest 1: The Interview

Ask the user "What is your favorite color?" using input(). Save their answer in a variable called color.

color = input("What is your favorite color?")
print(color)
Waiting for you to run code...

Quest 2: The Agreeable Genie

Now print "Wow I like " followed by their color!

print("Wow I like", color)

Tip: Use a comma ( , ) to join the text and variable.

Locked 🔒

Wizard's Exam 📜

1. What does input() do?

⌨️ EDITOR
Waiting for code...