Data types and variables
Operators
Modules and Packages
Conversion Programs
More Code Examples
Cheat Sheet

Hello world

Welcome to your first step in learning Python! In this lesson, you’ll write your very first program — the classic “Hello, World!” message. It’s a time-honored tradition in programming, and it’s the perfect place to start.

What is “Hello, World!”?

“Hello, World!” is the simplest program you can write in any programming language. Its only job is to display the message Hello, World! on the screen. This simple program helps you:

  • Test that Python is installed correctly.
  • Understand the basic syntax of the language.
  • Get a feel for how to run Python code.

Writing Your First Python Program

Step 1: Open a Python Environment

You can run Python in many ways:

  • Use an online Python interpreter like Replit or PythonAnywhere.
  • Open IDLE, which comes with Python.
  • Use a code editor like VS Code and run it in the terminal.

Step 2: Type the Code

print("Hello, World!")

That’s it! Just one line.

Step 3: Run the Program

  • In an online editor: Just click the Run button.
  • In a terminal: Save your file as hello.py and run:
python hello.py

You should see:

Hello, World!

🎉 Congratulations — you’ve written your first Python program!


What Does This Code Mean?

Let’s break it down:

print("Hello, World!")
  • print(...) is a function that outputs whatever is inside the parentheses.
  • "Hello, World!" is a string — a sequence of characters enclosed in quotation marks.
  • The output appears in the console or terminal.

Fun Fact

Why do programmers always start with “Hello, World!”?

It goes back to the 1970s, when a book on the C programming language used it as the first example. It’s simple, friendly, and instantly gives you success with just one line of code.


Quick Recap

  • The print() function is used to display text.
  • Strings are written inside quotation marks.
  • You can run Python code in a file or an online interpreter.

Challenge for You

Try printing something else! For example:

print("Welcome to Python!")
print("My name is Ada.")
print("Let's start coding!")

Experiment and have fun — that’s the best way to learn.