Chapter 1 · Curious Beginner

print() and strings

print() is a built-in function that writes text to the screen (technically: to standard output). You hand it a value inside the brackets and it shows that value, then moves to a new line.

A string is text. You write a string by wrapping characters in quotes — single '...' or double "...", Python treats them the same. The quotes are not part of the text; they just mark where the text starts and ends.

Think of print() as the program talking out loud. Nothing you compute is visible until you print it (or return it, or save it). A program that calculates the meaning of life but never prints anything looks, from the outside, like it did nothing.

Syntax

print(value)
print("some text")
print(value1, value2)  # space-separated

Worked examples

The classic first program

print("Hello, Rungo")
# Output:
# Hello, Rungo

print() adds a space between multiple arguments

print("score:", 42)
# Output:
# score: 42

Single and double quotes both make strings

print('one')
print("two")
# Output:
# one
# two

Common mistakes & gotchas

Forgetting the quotes

print(Hello) (no quotes) makes Python look for a *variable* called Hello, not show the word. With no such variable you get NameError: name 'Hello' is not defined. Text always needs quotes.

Mismatched quotes

You must open and close with the same quote type. print("hi') is a SyntaxError. If your text contains an apostrophe, wrap it in double quotes: "it's fine".

print() shows, it doesn't give back

print() returns None. You can't do x = print("hi") and expect x to hold the text — x becomes None. Printing is for humans looking at the screen; use a variable or return to keep a value.

Why it matters

Printing is how you see what your code is doing. Long before debuggers, developers found bugs by sprinkling print() calls to peek at values mid-run — and they still do. It's the first tool you reach for when something's behaving oddly.