Author Profile Altaf Shaikh
Altaf Shaikh

BE Engg | Python Dev | Content Writer | Founder of TeachMeBro | Blockchain Dev | Django

Python Syntax

January 8th 2020   1134

Basic Syntax of python
Basic Syntax of python

Python Indentation

One of the distinctive features of Python is its use of indentation to highlight the blocks of code. Whitespace is used for indentation in Python. All statements with the same distance to the right belong to the same block of code. Most of the programming languages like C, C++, Java use braces { } to define a block of code. So indentations are very important in python.

for i in range(5):

This will print numbers from 0 to 4

Let's try in the console

So if you skip the indentation python will give you an IndentationError like this,

Python Variables

Let's see the small introduction on variables and how to declare them in python. We will learn more about them in further tutorials.

x = 65
y = "Hello, Learners"

So this is how we simply declare variables in python.


Comments can be used to make the code more readable. Comments are used for the purpose of in-code documentation. Comments start with a # symbol, python interpreter will ignore the statement starting will this symbol. 

#This is a Comment

So this is how we comment line in python. 

Multi Line Comments

To add multi-line comment in python add the comment inside the triple quotes.

This is 


This is also a