python-by-example/lessons/hello-world.md at main · pycollege/python-by-example

Latest commit

Our first program prints the classic "hello world" message. Every Python program starts somewhere, and this is the simplest one—a single line that outputs text. Run it to confirm Python is installed and working.

What you'll learn:

  • How to run a Python script
  • The print() function for output

print() sends whatever you pass it to the terminal. Strings go in quotes—single or double both work.

To run this program:

$ python source/hello-world.py
hello world

You can also run Python interactively with python (or python3) to try commands line by line.

Try it: Change the string to "Hello, your name!" and run again.

Source: hello-world.py

Next: Values