3 Dec 2019

Create your First Python Program

First Python Program

Creating an Application where it will display Hello Python Users on the Screen.

Hi, here I am going to show how a simple program can be built in Python. A Python program can be written using any editor – however, most of the organizations use IDLE, Net Beans or Sublime Editor to write a Python program. Since IDLE is installed in my machine so I am trying to show and explain this topic using IDLE editor.                                                                                                    

Once you start IDLE the first screen that you will get is as follows:-

In the above picture >>> is also known as Python prompt – we can run and test a command directly by writing here as well. However to create a new File you can click on File -> New an empty file will be created where you can type the coding shown below.

The next Step is to save this file which you can do by Clicking on File ->Save or File->Save As command (See Picture below).

Next, it will ask the file name – you can choose your own destination folder and assign a filename. It will take .py as an extension so if the filename is given a name say First then the complete filename will be saved with First.Py

Next after saving you can run it by pressing F5 Key or by choosing Run -> Run Module Option – shown in the fig. below.

Once you run this program the following output will be produced:-



Look at the first line which is written as follows –

# Program

To Print ‘Hello Python Users’ on the Screen

If # appears at the beginning of a line in a program it becomes a comment statement which means this line will be ignored during execution of the program. The next line contains the statement like –

print(“Hello Python User”)

Here print() is used to display information on the screen – since within the () we have written “Hello Python User” so it will display exactly the same line on the screen. This print() is an inbuilt function in Python and is only used to show the output on the screen.