Your First Python Program

In the previous tutorial, you learned how to install Python on your computer. Now, let's write a simple Python program.

The following program displays Hello, World! on the screen.

print("Hello, World!")

Output

Hello World!

Note: A Hello World! program includes the basic syntax of a programming language and helps beginners understand the structure before getting started. That's why it is a common practice to introduce a new language using a Hello World! program.


Working of the Program

Congratulations on writing your first Python program. Now, let's see how the above program works.

Hello World Code
Hello World Code

In Python, anything inside print() is displayed on the screen.

There are two things to note about print():

  • Everything we want to display on the screen is included inside the parentheses ().
  • The text we want to print is placed within double quotes " ".

We can also use single quotes to print text on the screen. For example,

print('Hello World!')

is same as

print("Hello World!")

To be consistent, we will be using double quotes throughout the tutorials.

Next, we will be learning about Python comments.

Video: Introduction to Python

Did you find this article helpful?

Our premium learning platform, created with over a decade of experience and thousands of feedbacks.

Learn and improve your coding skills like never before.

Try Programiz PRO
  • Interactive Courses
  • Certificates
  • AI Help
  • 2000+ Challenges