In the previous blog, we have taken a general overview of what Python is, what different python environments are and it’s installation steps. Now in this blog, we’ll understand a few more key concepts of python.

Topics we’ll be discussing are

  • What keywords and identifiers are?
  • How to write comments in python?
  • What are Python statements are and How indentation works in python?


In programming, there are few words which impart a special message to the interpreters. These words are reserved words and can’t be used as identifiers name. (Don’t worry we’ll be covering this ahead)

They are used to define syntax/structure to the python program.

As Python is a case sensitive language, which means Keywords and identifiers must be spelt the same as they were written or declared.

There are 33 keywords as of Python 3.8.
 Note- Python is a dynamic language so the list of keywords may change in the future.


“An identifier is a user-defined word which can be used to declare or define a variable, a class, a function or an object name.”

Few rules must be followed to name an identifier –

1) A python identifier can be a combination of uppercase/lowercase letter, a digit or an underscore.

  • Uppercase letters [A-Z]
  • Lowercase letters [a-z]
  • Digits [0-9]
  • Underscore ( _ )

eg. _count, myVar or joe99_Dan

2) It must start with a letter or an underscore.

eg. Twin_data, _count

3) We can’t use any other special symbol.

4) A keyword can’t be used to name an identifier.

Note - ‘Variable’ and ‘variable’ are two different identifiers in Python.

Python Statements:

Single-Line Statements

Every single line of instruction that a python interpreter can execute is known as Statement.

All these above examples are single-line statements. Similarly, we have multi-line Statements as well.

Multi-line statements

In python, we can extend a statement over multiple lines using a special operator known as line continuation character(\)
Note - we can also use a set of parentheses for this purpose.

Multiple python statement in a single line

We can also put multiple statements on one line in python using a semicolon(;)

In Python, Unlike other languages we don’t use curly braces {}, to mark the start and end of a code block. Instead, we use indentation.

A code block starts (body of function or loops etc) starts with indentation and ends with the first unindented statement.

There are no strict rules on how one indents the code, but generally, 4 whitespaces are preferred and tabs are avoided.

Note – The indentation must be consistent throughout the block.


Comments are programmers tools to explain their code.

They are an important part of code while documenting. It describes what’s going on inside the program so that the other person who’s looking at the source code doesn’t have a hard time understanding it.It also expresses the key details of the program, one has written a while ago.

Good code also contains proper comments at the right place which explains the minute details of the program.Interpreters don’t execute the commented part of code.

Single Line comments:

In python, we use hash(#) to define a comment.

Multi-line comments:

If we have multiple lines of comment, one way to do that is by using the hash at the beginning of each line.

Another way is by using ”’ or “””.

Docstring python comment

DocString stands for Documentation String in python. It is the first statement of module, function, class or method, which usually explains the functionality of that block.

That’s all for this time. In the next blog, we’ll go through some more key topics in Python like variables and Data types. 

Till then Happy Coding!

Interview Questions

Q) Which of the following are invalid identifiers?

  1. myVar
  2. MyVar
  3. My_var
  4. 8My_var
  5. @My_vAR_
  6. else

Ans – D, E and F

 Q) What will be the output of the following code?


Categories: Miscellaneous


Leave a Reply

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

Insert math as
Additional settings
Formula color
Text color
Type math using LaTeX
Nothing to preview