Start free

Novice · Input and output · 11 of 264

A tiny story

Read an animal and a verb, and print a sentence with them.

Input: an animal on the first line, a verb on the second. Output: The <animal> likes to <verb>.

Examples

Input
cat
sleep
Output
The cat likes to sleep.
Input
dog
run
Output
The dog likes to run.

One more test checks other inputs when you press Check.

Stuck? The idea behind input and output

input() waits for one line typed by the user and gives it back as text. Keep it in a variable to use it later.

Each call reads one line, so a program that needs two answers calls input() twice.

name = input()
town = input()
print(f"{name} lives in {town}.")

Watch for: Don't put a question inside input("...") here: the prompt is printed too, and the tests compare everything printed.

All the input and output exercises
Your code
Opening the code editor…
Python 3.14 in your browser
Output
Run shows what your program prints. Check tests it on every example and the hidden tests.

More input and output exercises