Run it first, understand it second
print("Hello, world")
Run that. One line appears on the screen:
Hello, world
That's it. That's a complete program. You told a machine to do something, and it did it.
What that line actually did
Think of Python as a brand new coworker who follows instructions perfectly and guesses nothing. Hand them a clear instruction and they do it instantly, a million times, without complaining. Hand them a vague one and they stop and say "I don't know what you mean." They are never being difficult. They are being literal.
print("Hello, world") has three parts:
print— the name of the instruction. It means "put this on the screen." An instruction you can call by name like this is a function. For now, a function is a piece of ready-made behavior that someone else already wrote for you.( )— the parentheses mean "run it now." Whatever goes inside is the material you hand it. Like ordering coffee: saying "coffee" alone isn't an order, "one coffee" is."Hello, world"— the thing in quotes is a string, which is programmer-speak for "a run of characters." The quotes are a fence: everything between them is literal text, not something to interpret.
Quotes are not decoration
This is the first place beginners get tripped up. You might think the quotes are there to make the text look tidy. They're not. They change the meaning of what's inside.
Try this:
print(hello)
You get an error:
NameError: name 'hello' is not defined
Without quotes, Python reads hello as the name of something — it thinks you're saying "print the thing called hello." It searches for something with that name, finds nothing, and raises its hand: "I've never heard of this."
Here's the rule that carries you through every lesson that follows:
- With quotes → this is the text itself.
- Without quotes → this is the name of something.
Hold onto that. Half of the confusing errors you'll hit in your first month come from mixing these two up.
Single quotes or double quotes
Python accepts both, and they mean exactly the same thing:
print('Single quotes work')
print("Double quotes work too")
Output:
Single quotes work
Double quotes work too
The one rule: don't mix them on the same string. print("mixed') is an error, because Python starts a string at the double quote and then reads to the end of the file looking for a matching double quote that never comes.
Having two options is useful when the text itself contains a quote:
print("It's a nice day")
Output:
It's a nice day
The apostrophe inside is fine, because the fence is made of double quotes.
Printing several things at once
Separate them with commas. Python joins them with a single space:
print("I am", 18, "years old")
Output:
I am 18 years old
Notice that 18 has no quotes. It's a number, not text. Python treats those as two genuinely different kinds of thing, and that difference becomes very important in lesson 3. For now, notice that print accepts both without complaint.
Notes to your future self
print("Hello") # this part is a comment
# this whole line is a comment too
Output:
Hello
Anything after a # is ignored completely by Python. Comments are written for humans — for the teammate reading your code, and for you three weeks from now, who will remember none of this. Writing them costs seconds and saves hours.
Ten-second check
What does this print?
print("1 + 1")
Think before you scroll.
The answer is 1 + 1. The quotes make it text, so Python prints it exactly as written and never does the arithmetic. Remove the quotes:
print(1 + 1)
Output:
2
Now there are no quotes, so 1 + 1 is a calculation, Python works it out, and print shows the result. Same characters, two completely different meanings, decided entirely by a pair of quotes.