Latest Update: New tutorials and tech news coming soon! Stay tuned at TechRouteBP.

GETTING STARTED WITH PYTHON

by Bathula Praveen - Oct 05, 2025
IMG


 GETTING STARTED WITH PYTHON

 The Python language had a humble beginning in the late 1980s when a Dutchman Guido Von Rossum started working on a fun project, which would be a successor to ABC     language  with better exception handling and capability to interface with OS Amoeba at Centrum Wiskunde and Informatica. It first appeared in 1991. Python 2.0 was released in the year 2000 and Python 3.0 was released in the year 2008. The language was named Python after the famous British television comedy show Monty Python's Flying Circus, which was one of Guido's favorite television programmes. Here we will see why Python has suddenly influenced our lives and the various applications that use Python and its implementations. In this chapter, you will be learning the basic installation steps that are required to perform on different platforms (that is Windows, Linux, and Mac), about environment variables, setting up of environment variables, file formats, Python interactive shell, basic syntaxes and finally printing out formatted output.


 WHY PYTHON?

Now you might be suddenly bogged with the question, why Python? According to Institute of Electrical and Electronics Engineers (IEEE) 2016 ranking Python ranked third after C and Java. As per Indeed.com's data of 2016, the Python job market search ranked fifth. Clearly, all the data points to the ever rising demand in the job market for Python. Its a cool language if you want to learn just for fun or if you want to build your career around Python, you will adore the language. At school level, many schools have started including Python programming for kids. With new technologies taking the market by surprise Python has been playing a dominant role. Whether it is cloud platform, mobile app development, BigData, IoT with Raspberry Pi, or the new Blockchain technology, Python is being seen asa niche language platform to develop and deliver a scalable and robust applications.


SOME KEY FEATURES OF THE LANGUAGE ARE :

-> Python programs can run on any platform, you can carry code created in Windows machine and run it on Mac or Linux

->Python has inbuilt large library with prebuilt and portable functionality, also known as the standard library

->Python is an expressive language

->Python is free and open source

->Python code is about one third of the size of equivalent C++ and Java code

->Python can be both dynamically and strongly typed--dynamically typed means it is a type of variable that is interpreted at runtime, which means, in Python, there is no need to define the type (int or float) of the variable


 PYTHON APPLICATONS:

One of the most famous platforms where Python is extensively used is YouTube. The other places where you will find Python being extensively used are the special effects in Hollywood movies, drug evolution and discovery, traffic control systems, ERP systems, cloud hosting, e-commerce platform, CRM systems, and whatever field you can think of.

WRITE A SIMPLE HELLO WORLD PROGRAM:

Congratulations on your successful installation. Now you can start programming. Open Notepad++ and create a new file. In the new file, type the following

>>> print("hello world")

hello world


COMMENTS IN PYTHON:

In Python, there are two types of comments--one is a single-line comment and the other is multiline comment.

->For a single-line comment, # is used.

-> for a multiline comment.triple quotes """ are used:


#This is a single line comment in Python

print "Hello World" #This is a single comment in Python

""" For multi-line

comment use three

double quotes

...

"""

print "Hello World!"


STRING INSIDE THE QUOTES :

or printing a string, either a pair of single (' ') quotes or pair of double quotes (" ") can be used as shown in the succeeding examples:

>>> print("Hello 'Mr' BP YADAV")

Hello 'Mr' BP YADAV

>>> print('BP "stands for" BATHULA PRAVEEN')

BP "stands for" BATHULA PRAVEEN

Escape sequence in Python:

The escape sequence is used to insert the tab, the newline, the backspace, and other specialn characters into your code. They give you greater control and flexibility to format your

statements and code:

Escape   Sequence Meaning

b      ->       Backspace

a       ->    Sound system bell

n       ->      Newline

t        ->      Horizontal tab               

'         ->     Single quotation mark

"        ->     Double quotation mark


STRING CONCATENATION:

Two strings can be joined using the + operator:

>>> print ("Only way to join" + "two strings")

Only way to jointwo strings


FRMATTED OUTPUT :

Consider an example where you would want to print the name, marks, and the age of the

person:


print ("Name", "Marks", "Age")

print ("PRAVEEN", 80.67, "27")

print ("HARISH", 76.908, "27")

print ("YASIN", 56.98, "25")


The output will be as follows:

Name Marks Age

PRAVEEN 80.67 27

HARISH 76.908 27

YASIN 56.98 25


->You can see the output, but the output that is displayed is not formatted. Python allows youn to set the formatted output. If you have done some coding in C language, then you should be familiar with %d, %f, %s. In order to represent an integer %d is used, %f is used for float, and %s is used for string. If you used %5d, it means 5 spaces. If you used %5.2f, it means 5 spaces and .2 means precision. The decimal part of the number or the precision is set to 2.

Let's use the formatting on the preceding example:


print ("Name Marks Age")

print ( "%s %14.2f %11d" % ("PRAVEEN", 80.67, 27))

print ( "%s %12.2f %11d" %("HARISH" ,76.901, 27))

print ( "%s %3.2f %11d" %("YASIN", 56.98, 25))

OUTPOT:

Name Marks Age

PRAVEEN  80.67    27

HARISH     76.90    27

YASIN       56.98       25


INDENTATION :

The most unique characteristic of Python, unlike other programming languages, is indentation. Indentation not only makes Python code readable, but also distinguishes each

block of code from the other.  

Let's explain this with an example:

def fun():

    pass

for each in "A":

       pass

While writing the code, a new block of code starts with a colon followed by a tab. Here, after the function fun(), a colon is provided which will start the function body, pass is part of the function fun() and it is placed at one tab space. Likewise, the for loop starts with a colon. Here, most people get confused whether to use a tab or space. It is advisable to stick to only one type and follow the same across the whole code. If the indentation is not strictly implemented, then code execution will throw an error.

SUMMARY:

So far, we did a walkthrough of the beginning and the brief history of Python.  We learned about basic syntaxes that are used in writing the code and also we learned about various escape sequences that would make writing the code simple. We finally learned about the importance of indentation in Python.


Popular Post