Introduction

In this first code tutorial of the series, we will dive into the exciting world of Python programming by exploring the timeless tradition of writing our very first program: "Hello World." Whether you're a complete beginner or an experienced programmer looking to learn a new language, this tutorial will serve as the perfect starting point. Python's simplicity and readability make it an excellent choice for beginners, while its power continue to attract professionals worldwide. So, let's start this programming journey together and greet the world with our Python prowess!

Table of Contents :

  • Writing First Program in Python - "Hello World"
  • Python "Hello World" using simple Notepad method
  • Python "Hello World" using IDLE method 

Writing First Program in Python - "Hello World"

  • We can use any python IDE to create our first Python program "Hello World".
  • In this tutorial we'll keep things simple and run our program in two ways:
    • using simple notepad to write code and using command line to execute code
    • using Python IDLE to both write and execute code

Python "Hello World" using simple Notepad method :

Below are the steps for writing and running hello world program using notepad -

  • Open Notepad.
  • enter the following code in the file:

print('Hello, World!')

# print() is a built-in function in python 
# print() is used to display messages on the screen. 
# In this example, it’ll show the message 'Hello, World!'.

  • save the file with name hello.py. You can name it whatever you want.
  • Open the command line Interface on Windows or Terminal on macOS or Linux.
  • Navigate to the location where you have saved the above file.
  • Type the following command to execute the hello.py file:
     python hello.py 
  • On macOS or Linux, you will have to use python3 command instead:
     python3 app.py 
  • Following message will be displayed on the screen:
     Hello, World! 

Python "Hello World" using IDLE method :

  • IDLE is the integrated development and learning environment.
  • It comes with the python distribution by default.
  • IDLE is very suitable for writing small programs for testing and learning purpose.
  • Its very easy to test small piece of code with IDLE.

Writing our Python "Hello World" program in IDLE

  • Launch IDLE from start menu in Windows.
  • type the code  print('Hello, World!')  after the cursor.
  • print() is an in-built function in python used to display messages on the screen
  • press Enter, 
  • The message  Hello, World!  will be printed immediately on the screen.

Prev. Tutorial : Install and run Python

Next Tutorial : Top IDEs for Python