Python print(): Your First Hello, World

XMLans Posted on 2025-04-01 12 Views


Python is used for scripting, web development, data analysis, and many AI tools. This first lesson starts with a much smaller goal: display a line of text.

If you still need an editor or interpreter setup, the original setup article (Chinese) is linked here for reference. Use a supported Python 3 installation.

Hello, World

print("Hello, World!")

Run the file in your editor or with the Python interpreter. The console displays:

Hello, World!
Illustration for the original Python print lesson

The parentheses contain the argument passed to print. Quotes mark a string literal; the quote characters themselves are not printed. Single quotes work too, as long as the opening and closing marks match:

print('Hello, World!')

print displays output and normally adds a newline. It does not return the printed text as its function result; its return value is None. We will explore variables and return values in later lessons.

A small exercise

print("I can learn Python one step at a time!")

Change the sentence and run it again. If you see a syntax error, check the parentheses and matching quotes. Learning the basic syntax is only a start, but being able to run a tiny program makes the next lesson much easier.

Adapted from the original Chinese article, published on April 1, 2025.

Hi! I frequently update with various articles about technology, practical tips, and cutting-edge news. I hope it will be helpful to you!
Last updated on 2026-09-30