print()
Do?The print()
function in Python is used to display text or variables on the screen. It's one of the most basic — and most useful — functions you'll use in Python.
Here’s how you use it:
print("Hello World")
When this line runs, Python outputs:
Hello World
The print()
function helps you understand what your code is doing. Whether you're displaying messages, checking results, or debugging, you'll use print()
often as you learn to code.
if
, for
, while
, etc.'
or "
) — curly quotes (“”
or ‘’
) will cause errors.#
# This is a comment
print("Hello") # This prints Hello
Keep your syntax clean to avoid simple bugs.