Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 805 Bytes

File metadata and controls

28 lines (18 loc) · 805 Bytes

Python by Example: Hello World

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("hello world")

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