Print & Input

A free sample lesson from Python Fundamentals

The idea

Think of print() as a megaphone - whatever you hand it gets announced out loud for anyone looking at the screen. You can hand it more than one thing at once, separated by commas, and it announces them all together with a space in between. Later on, input() works like a mailbox instead - your program pauses and waits for someone to hand something back before it continues.

What it actually is

print() is how your program shows text on the screen, and input() is how it asks the person using it a question and waits for an answer. Together, they're how a program actually talks with someone instead of just running silently.

How you write it

print(value1, value2, ...)
answer = input("question: ")

A worked example

print("Score:", 100)
print("Level:", 3, "Lives:", 2)

print() can take several things separated by commas - it prints them all on one line with a space automatically placed between each one, so line 1 shows 'Score: 100' and line 2 shows all four pieces together on a single line.

print("Name:", "Kai", "Age:", 9)

print() can take as many pieces as you like, separated by commas - it announces every one of them on the same line, automatically placing a single space between each piece, whether they are text or numbers.

Mistakes children actually make

Mistake 1: trying to join text and a number with + instead of a comma, e.g. print("Score: " + 100) - this crashes with a TypeError because + demands text on both sides; print("Score:", 100) or print("Score: " + str(100)) both work. Mistake 2: forgetting input() always returns text, so age = input("Age: ") stores whatever was typed as a string, not a number, even if the person typed digits. Mistake 3: not realizing print() always adds an invisible newline at the end by default - two separate print() calls always land on two separate lines, even with nothing telling them to; use the end parameter (e.g. end="") if you want the next print() to continue on the same line instead.

Then they try it

In the app this lesson continues with the animated explanation, spoken aloud, and then the practice: Change the greeting so it prints exactly: Hello Aanya (use print with multiple arguments). The editor runs your child’s real code and checks the result, with their coding buddy reacting to what they wrote.

Try it free