Python Foundations · Lesson 1 of 12Getting started with Python
print(), comments and running a script. Learn through short examples, practical tasks and targeted questions.
← All lessons
Printing messages and comments
The print() function sends information to the console, which is useful for giving feedback and checking that a program reaches a particular line. A comment starts with # and is ignored when the program runs. Try changing the quoted message, then add a second print statement to see the output appear on separate lines.
Watch out: A frequent beginner mistake is to forget quotation marks around text. Python treats unquoted words as names of variables, not messages.
A free TutorSyntax programming lesson. About our teaching approach.
APPLY THE IDEA
Use this skill beyond the example
Printing a message is often the first debugging tool you learn. Before running a program, predict exactly what the console will display, including spaces and punctuation. Then change just one string and compare the output.
Quick check: What is the difference between text inside quotation marks and a Python comment?
Check: A string passed to print() is displayed; a comment starting with # is ignored when the program runs.
Continue with related practice →