Skip to content
Codewilds

Lesson 1 of 34 · Fundamentals

Python Hello World: Your First Program

easy10 XP3 min readFree lesson

Welcome to Serpent Hollow! Every programmer's journey starts the same way: by making the computer say hello. In this first lesson you will write and run a real Python program — right here in your browser, with nothing to install.

Python is one of the most popular programming languages in the world. It powers websites, automation scripts, data science, machine learning, games and countless tools, and its clean, readable syntax makes it a perfect first language.

Your first Python program

Here is a complete Python program:

print("Hello, World!")

When you run it, Python prints:

Hello, World!

Three things are happening in that single line:

  • print is a built-in function — a ready-made command that ships with Python. It writes text to the output, often called the console.
  • The parentheses ( ) call the function. Whatever you put inside them is the value you want printed.
  • "Hello, World!" is a string — a piece of text. The quotes tell Python exactly where the text starts and ends.

Python runs your code from top to bottom

A Python program is a list of instructions that runs one line at a time, from the top of the file to the bottom. Every print() call writes one line of output:

print("Line one")
print("Line two")
print("Line three")
Line one
Line two
Line three

print() also accepts several values separated by commas. It prints them on one line with a space in between, and it can print numbers and calculations too:

print("Level", 1)
print("2 + 3 =", 2 + 3)
Level 1
2 + 3 = 5

Notice that 2 + 3 was calculated before it was printed. It is not inside quotes, so Python treats it as a math expression rather than as text.

Single or double quotes?

Python accepts both 'single' and "double" quotes for strings, as long as the opening and closing quotes match. Choose the kind that doesn't clash with your text:

print("It's dangerous to go alone!")  # apostrophe inside double quotes
print('The sign says "Keep out".')     # double quotes inside single quotes

Comments

Everything after a # on a line is a comment. Python ignores comments completely — they are notes for the humans who read your code.

# This whole line is a comment.
print("Comments are ignored")  # So is this part.

Good comments explain why the code does something. You'll see them throughout this course.

Common mistakes

  • Forgetting the quotes: print(Hello) makes Python look for something named Hello, and the program stops with a NameError.
  • Wrong capitalisation: Python is case-sensitive. Print("hi") fails; the function is called print.
  • Old Python 2 syntax: very old tutorials write print "hi" without parentheses. In Python 3 that is a SyntaxError.
  • Mismatched quotes: print("hi') opens with " but closes with ', so Python can't find the end of the string.

Assignment

Write a program that prints exactly these two lines:

Hello, World!
I'm learning Python!

The output must match exactly — capital letters, spaces, punctuation and the apostrophe in I'm all count. Run your code to see the output, then submit it to check.

Hello World in other languages

Need a quick reminder? The Python cheat sheet has every topic of Learn Python on one page.

Lesson last updated on .

Write code ↓
Python+10 XP

Press Run to execute your code, or Submit to check it against the tests.