Register to get access to free programming courses with interactive exercises

Hello, World! Python Basics

Hello World

"Hello, World!" is the traditional way to begin learning a new programming language. It is a simple program that displays a greeting on the screen and introduces the new language by showing its syntax and program structure.

We're not breaking this tradition since it is over forty years old. In the first lesson, we'll write a program called Hello, World!. To do this, you need to give the computer a special command. That is print() in Python:

print('Hello, World!')
# => Hello, World!

We used a comment to explain more about what value is displayed.

How comments work

Almost all programming languages allow you to leave comments on your code. The interpreter ignores them. They're only for people; they let the programmer make notes for themselves and other programmers.

They allow you to add explanations of how the code works, what errors need to be corrected, or what you need to remember to add later:

# Delete the line below after you finish the registration task
print(10)

In Python, comments begin with the # sign and can appear anywhere in the program. They can take up an entire line. If one line isn't enough, you can create several comments:

# For Winterfell!
# For Lannisters!

The comment can be on the line after the code:

print('I am the King')
# For Lannisters!

Recommended materials

  1. A little bit about Hello, World!

Sign up

Programming courses for beginners and experienced developers. Start training for free

  • 130 courses, 2000+ hours of theory
  • 1000 practical tasks in a browser
  • 360 000 students
By sending this form, you agree to our Personal Policy and Service Conditions

Our graduates work in companies:

Bookmate
Health Samurai
Dualboot
ABBYY