First Program Hello World In Python Programming Language

In this lesson, we will learn different ways to start Python and we make our first full-functioning Python Program that will show the result on the output screen. Python includes many features from C, Perl, and Java but not the same as these languages.  It is always a good choice to install the most current version of Python Programming Langage which you can download and install easily.

Before moving forward for making our first Python Program we need to start/locate our Interpreter.

Starting the Interpreter

When you have installed your Python successfully on your machine now it’s time to locate Python Interpreter. The location address /usr/local/bin/pythonX.X is default location in Linux/Unix OS but in Windows OS the default address is C:\PythonXX or in some cases location might be different and remember by “X” means the current version of Python Programming Language.

Before doing anything else first thing we have to do is to start the Python interpreter so it makes possible for our code to run and show the output to the screen. To access the Python simply open up your command prompt and type “python” as shown in the image below but make sure you have installed the Python on your computer successfully.

Recommended:  9 Best IDE For Python Programming Language

Access-Python-From-Interpreter

After setting up our Interpreter we can discuss the ways to start the Python Language.

1.Immediate mode

In immediate mode we run code without making any file separately so, we do direct coding to show the output to the screen. To do so simply open the command line and type “python” it will invoke the python’s interpreter. We can directly type our Python piece of code and press enter to get the output to the screen.

does the above symbol appears if yes then it is the sign that the Python interpreter is ready to use. Now for testing purpose type the following expression as

3 * 3 and press enter you should get the 9 in the output. You might say that it is our very basic calculator to use.  To exit simply type exit() or quit() and that’s it.

2.Script Mode Programming

Generally, we mean something in writing by word script for example script for actors etc. In Python, we mean a piece of code written in a separate file which we access with Python IDLE(Integrated Development Environment). I will do step by step process to make sure you will understand everything easily. So let’s begin.

Recommended:  For Loop In Python Programming Language

First, open up your notepad and type the whatever Python code you want to show up on the output screen.

Remember! You must write “print” before starting any expression to tell the interpreter that we want to show the output to the screen. And enclose you expression inside “middle brackets“. An illustration is presenting in the image below.

Python-Programming-Language-In-script-mode

Now go to File > Save as > and write your file name and don’t forget to add the .py extension at the end of file name like HelloWorld.py. It is highly recommended to add the .py extension.

After this open your Python IDLE Go to File > Open and locate your saved notepad file wherever you save it. When file opened press shortcut key “F5” to run your code. In my case, the following result has shown to the screen.

Python-Code-In-Python-IDLE

3.Python Integrated Development Environment (IDE)

It is the most time saving and easiest way to write and work with Python Programming Langauge because an IDE comes with many great features like syntax highlighter, error identification, indentation, and file explorers, etc. It provides an easy approach from an expert programmer to a beginner.  You can also check out the Best IDE.  By working with IDE you won’t have to open python shell or don’t have to start the command prompt to run your code an IDE handles all itself.  You can customize IDE according to your need.

Recommended:  Decision Making Statements In Python Programming Language

First Program in Python Programming Language

In your script file or in your Python IDE no matter what IDE you installed type the code listed below as our first programming code:

After running this code you should have the following output to the screen:

Congratulations! You just have achieved an accomplishment of writing your first program in Python.

 

Jack Sparrow

Hay I am Admin Of This Website. I am very passionate about Computers and technology. This website is the result of my passion. I love to eliminate the barriers comes in the for seeking education. This website is the free source of learning about new technology and up to date knowledge.

Leave a Reply

Close Menu