Python Programming: Basic Syntax


Today we will be going through the Python programming’s basic Syntax and how to use it to make your programming easy and more compatible than other programming languages. As your basics are the building blocks of any language it is necessary to be thorough with the basics. so in this article you will get to know the simplest of the syntax used in Python programming.


Python is very different from other programming languages. The way of writing a Python program depends upon the Indentation Style. So basically what is indentation?

Indentation means a Structured way of writing a code. For example when you write a paragraph in your notebook. Therefore to differentiate between two paragraphs we Indent them by giving a line gap between them.

So now we will see how it is applied in Python. So i will give you an example of “if” statement.

#User types a string for example girl friends name
love=input("Enter a String")
#Now we will be seeing indentation
if love=="Deepika":
   print("True Lover")
   print("Your Love partner exchanged")

Now see the if Statement and the next line print Statement. See if it starts from the first character, but the print statement starts from the 5th character space this makes the program easier to understand and it is compulsory in python that you follow indentation. If it is not followed then the compiler will throw an error.

So to start any Function, Conditional, Class etc we need to indent them to differentiate them from each other and it doesn’t have Curly brackets to separate one code from another.

Multi-Line Statements

Let us understand what Multi-Line Statements means with a small example :

Suppose, there are 5 students and they want to sit together on a bench, but the bench can occupy only 3 person. So the solution to this problem is that the other 2 students have to sit behind them on the next bench or next line.

friends= first_bench + \
         second_bench + \

Multiline Special Character Symbol is “\”.

Statements contained within the [], {}, or () brackets do not need to use the Multiline character. For example −

friends = ['Sonu', 'Monu', 'Titu',
        'bholu', 'balla',"Shalinder"]

Quotes in Python

Python uses single (‘), double (“) and triple (”’ or “””) quotes to denote string literals, as long as the same type of quote starts and ends the string.

iplt20 = 'Cricket'
Game = "IPL is cricket league"
brief_ipl= """IPL is the most interesting league in cricket. Young
talents are given chance to play."""
Also Read:- 

About Anurag

You can call me the Tech Buffer because I love the way technology is moving inside me. I fascinate the way phones take pictures to the way Google finds its search result.

View all posts by Anurag →

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.