Hello again. In the previous lesson, you created a .py file in IDLE, saved it, and ran it with F5. You learned that the editor window is where you write a saved program, while the Shell is where Python shows its output.
Now you will take control of that output. By the end of this lesson, you will be able to use Python’s print() function to display text, whole numbers, decimal numbers, and clear messages containing more than one item. This is a small skill with a big purpose: every useful program needs a way to communicate what it is doing.
print() sends information to the screen
print() is a built-in Python function. A function is a named piece of code that performs a task. The task of print() is simple: it displays information in the Shell.
Here is a program with one print() instruction:
print("Python is running.")
When you run the program, the Shell displays:
Python is running.
Notice what does not appear in the output:
- The word
print - The parentheses
- The quotation marks
Those parts tell Python how to display the message. Only the message itself becomes output.
The parentheses matter. They show Python that you are calling the print function. The information inside the parentheses is what you want Python to display.
Python Basics: A Practical Introduction to Python 3
Read the beginning of Chapter 3, “Your First Python Program,” from Real Python. It reinforces how print() works in both IDLE’s Shell and editor, including why parentheses and quotation marks are needed.
In Chapter 3, Section 3.1, “Write a Python Program” (pp. 43-45), start at the paragraph beginning “At the prompt in the interactive window” and read the first print example. Then continue through the explanation of using an editor window. Focus on the difference between code you type and the output Python displays.
A useful way to read a line of code is:
print("Python is running.")
| Part | Meaning |
|---|---|
print | The function’s name |
( and ) | Marks that the function is being called |
"Python is running." | A piece of text given to the function |
| Entire line | An instruction for Python to carry out |
Python is extremely exact. Print, PRINT, and print are not the same thing. Use lowercase print.
Text needs quotation marks
In programming, text is called a string. A string can be a word, a sentence, a username, or even a sequence of digits when those digits are meant to be text.
Put quotation marks around text:
print("System check started")
print("Learning Python")
print("A password should stay private")
Each line produces one line of output:
System check started
Learning Python
A password should stay private
Python accepts either double quotation marks or single quotation marks:
print("Hello")
print('Hello')
Both display:
Hello
For this course, use double quotes most of the time. It makes your code consistent and easier to scan.
The quotation marks do not become part of the output. They tell Python, “treat what is inside as text.” Compare these two lines:
print("100")
print(100)
Both appear as:
100
100
But they are not the same kind of value:
"100"is text: three characters,1,0, and0.100is a number.
For now, print() makes them look identical. Later, when you calculate with numbers and collect input, the difference will matter a great deal.
A common beginner mistake is to forget the quotation marks:
print(Welcome)
At this stage, Python does not know that Welcome should be text. It will look for something named Welcome instead. Write this instead:
print("Welcome")
Displaying whole numbers and decimal numbers
You can print a number directly, with no quotation marks.
print(7)
print(250)
print(-12)
print(3.5)
The output is:
7
250
-12
3.5
A whole number such as 7 or 250 is called an integer. A number with a decimal point, such as 3.5, is called a floating-point number, often shortened to float.
At this point, you do not need to memorize those labels. The practical rule is enough:
- Use quotation marks for text.
- Do not use quotation marks for a number you intend to use as a number.
This short video gives a visual demonstration of the same distinction in IDLE.
print Function | Python Tutorial
Watch “print Function | Python Tutorial” by Portfolio Courses for a compact demonstration of printing numbers, text, and several items in one statement.
Watch the purpose for the basic role of print(). Then watch numbers and text to see integers, decimals, and quoted strings. Finish with multiple values; focus on the spaces Python places between separately printed items.
One print() line at a time
By default, every print() call finishes on a new line. Python runs your saved script from top to bottom, so the order of your instructions becomes the order of the output.
print("Security learning log")
print("Lesson 2")
print("Status: ready")
Output:
Security learning log
Lesson 2
Status: ready
This lets you structure output like a small report. Clear output is important in every area of software: a person using a program needs to understand what happened, and a programmer needs to check what the program is doing.
You can also place several separate items inside one print() call, separated by commas:
print("Port:", 443)
print("Attempts:", 3)
print("Python version practice:", 1)
Output:
Port: 443
Attempts: 3
Python version practice: 1
The comma separates items in your code. Python displays a space between those items in the output.
This is especially useful when you want to label a number clearly. Compare:
print(3)
with:
print("Attempts:", 3)
The first output is only a number. The second tells the person reading it what the number means.
For this lesson, commas are the easiest and clearest way to place text and numbers together. Do not try to join text and numbers with + yet; you will learn safe ways to format richer messages after you have learned variables and calculations.

The image’s first two lines show an important contrast:
print(number)
print('number')
Later, number can be the name of a stored value, while 'number' is the literal text number. For now, stay with values written directly in your print() calls, such as print(100) and print("number").
Guided build: a simple program status screen
Open your first_script.py file in IDLE, or create a new file named print_showcase.py in your PythonProjects folder. Replace its contents with this program:
print("Python output practice")
print("Project: First status screen")
print("Lesson number:", 2)
print("Checks completed:", 4)
print("Temperature:", 21.5)
print("Status:", "ready")
Save with Ctrl+S, then run with F5. Your Shell should show:
Python output practice
Project: First status screen
Lesson number: 2
Checks completed: 4
Temperature: 21.5
Status: ready
Read the output as though it were a mini report. The labels make each number understandable without needing to inspect the code.
Make two personal changes:
- Change the project name to a title you like.
- Change the lesson number, completed checks, and temperature to other numbers.
Each time, save before running. You are building the core programming habit from last lesson: edit, save, run, inspect.
When the output is not what you expected, compare the code and output carefully. Check:
- Is
printlowercase? - Does every opening parenthesis have a closing parenthesis?
- Does every text string have both opening and closing quotation marks?
- Did you save the latest version before pressing
F5?
The next lesson will focus on what Python does when one of these rules is broken and how an error message helps you locate the problem.
Key takeaways
print() is Python’s basic tool for displaying output in the Shell.
- Write text inside quotation marks:
print("Hello"). - Write numbers without quotation marks:
print(42)orprint(2.5). - Each
print()normally displays its result on a new line. - Use commas to display several items together:
print("Score:", 10). - Text such as
"100"and the number100may look the same when printed, but Python treats them differently.
Next, you will intentionally examine a simple syntax mistake and use Python’s error message and line number to fix it.
Can't find a good explanation? Sign up and we'll make it for you
Sign up