Hello World Python

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/hello-world-python/
PINTEREST
PINTEREST
INSTAGRAM

We have talked about Python programming language previously. You can find them in Programming > Python section. Creating working environment for Python development and running our first python application is the first step to learning PYthon. In this tutorial we will look a Hello World python application about how can we create and run?

Create Source Code File

We will follow simple steps to create a source code or application file. In this way we will do not need any IDE or other third party applications. We will create our Hello Word application in a file named helloworld.py . We use py as extension to specify this . We will put following single line of code into helloworld.py file.

Check Python

We will check whether python interpreter is installed. There is two main version of Python and its interpreter. We will prefer the never one which is Python3  . The older one is Python2. We will list the version of python like below.

If we specify only python command and -V option we see that default python interpreter is Python2. We can explicitly specify Python3 with python3 command like below.

Check Python
Check Python

Run Code With Python Interpreter

And we are here. We will run our source code file named helloworld.py against Python3 interpreter. We will issue them in command line like below.

Another way to run python file helloworld.py is making it directly executable in bash. We will make it by using chmod command like below.

LEARN MORE  How to Install Pip in Debian, Ubuntu, Kali

And we can run python file directly like below.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/hello-world-python/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.