Creating a simple Python program in Kali Linux

We know that Python comes built-in with Kali Linux. To check which Python version has been installed in Kali Linux. Open Linux terminal and enter python.

root@kali:~# python
Python 2.7.17 (default, Oct 19 2019, 23:36:22)
[GCC 9.2.1 20191008] on linux2
Type "help", "copyright", "credits" or "license" for more information.

Kali Linux has Python 2.7.17  installed.

In this blog we will be creating a simple python program using nano editor. Open Linux terminal and type nano followed by filename with extension .py.

Below is the syntax

nano [filename]

We will use nano editor to create a simple python file called display.py which displays some messages

Type below command to create new file

root@kali:~# nano display.py

We move into nano editor. Now writing a simple print command to display message

Entering below command within the editor. Saving the content and exiting using ctrl + X

print('Hi This is Python in Kali Linux')

Above code has been written according to Python3.

Now at the terminal type below command in order to print content the file

root@kali:~# python3 display.py

Below is the output after running above command

Hi This is Python in Kali Linux

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s