Getting StartedBeginner6 min03 / 63

Your First Program

Write your very first line of Python and make the computer say hello to the world.

Every programmer in history has started exactly where you are right now. The very first program almost everyone writes is called Hello, World! — and it is a tradition going back to the 1970s.

Your goal in this lesson: make the computer display a message on the screen. That is it. One line of code. Let's go.

See it in action

Visual walkthrough1 / 5
1

Your First Python Program

Every programmer starts here — a tiny program that makes the computer display a message. One line of code, and you're officially a Python programmer.

Hello, World! is a tradition going back to the 1970s — you're joining a long line of coders.

#What is print()?

Python has a built-in command called print(). Think of it like a megaphone — whatever you put inside the parentheses, Python will shout it out onto your screen.

The parentheses () are how you hand something to a command. Everything inside is the message you want to display.

Think of it like

print() is like a megaphone

Imagine handing a note to a friend and saying "read this out loud." print() is that friend. You put your message inside the parentheses, and Python reads it out loud — onto your screen.

#Your First Line of Code

The classic first program. One line, and it works!
print("Hello, World!")

When Python runs this line, it looks inside the parentheses, finds your message, and displays it. The output appears instantly below your code.

You just wrote a real, working Python program. Take a second to appreciate that.

#Why Do We Need Quotes?

The quotes around "Hello, World!" tell Python: this is text, not a command. In Python, a piece of text wrapped in quotes is called a string.

Without quotes, Python would think Hello is the name of something it should look up — and it would get confused and show an error.

Common mistake

Forgetting the quotes causes an error

``python print(Hello, World!) ` This will **crash** with a SyntaxError. Python sees Hello and World` as unknown names, not text. Always wrap your text in quotes.

#Single Quotes Work Too

Single quotes and double quotes are both fine for strings.
print('Hello, World!')

Python accepts both 'single quotes' and "double quotes" around strings. The output is identical. Most people pick one style and stick with it — but you can use either. Just make sure your opening and closing quote match!

#Printing Multiple Things at Once

You can print more than one item in a single print() call by separating them with a comma. Python will put a space between each item automatically.

Commas separate items; Python adds a space between them.
print("Hello", "World", "from Python!")
Tip

Print as many items as you like

There is no limit to how many items you can pass to print(). Each comma-separated value gets printed on the same line, separated by a single space. Great for mixing text and values later on!

#Printing Multiple Lines

Each print() call starts on a new line.
print("Hello, World!")
print("I am learning Python.")
print("This is awesome!")

Every print() call automatically ends with a newline, so the next print() always starts on a fresh line. You can stack as many as you need.

#Check Your Understanding

Quick check

What will this code print? print("Python", "is", "fun")

Key takeaways

  • `print()` displays text (and other values) on the screen.
  • Text in Python must be wrapped in quotes — either single `'...'` or double `"..."` — to be treated as a string.
  • Separate multiple items with commas inside `print()` and Python adds spaces between them automatically.
  • Each `print()` call outputs on its own line.
  • You just wrote real Python code — every expert started exactly here.
Practice challenges
Test yourself · earn XP
0/4
Predict the output#1

What does this code print?

predict-output
print("Hello", "World", "from Python!")
Fix the bug#2

This code has a bug. What is wrong?

fix-bug
print(Hello, World!)
Fill in the blank#3

Complete the code so it prints: Learning Python is fun

("Learning Python is fun")
Reorder the lines#4

Put these lines in the right order so the program prints three lines: Hello!, I am learning Python., See you soon!

1
print("See you soon!")
2
print("Hello!")
3
print("I am learning Python.")
Your turn
Practice exercise

Write a small program that introduces yourself. It should print three lines: your name, what you are learning, and one thing you are excited about. Use at least one print() call that has two items separated by a comma.

Try it live — edit the code and hit Run to execute real Python:

solution.py · editable