Python is very popular language these days. Here we will see various Python Interview questions and answers asked in job interview. These questions are very basic and helps for those who are looking for Python tutorial for beginners.

What is Python?

Python is Programming language. Python is very popular these days because In Python we can create any application either it is desktop application or web application. Python also used in Machine learning and data analytics. Python provides a wide range of modules. Python is very easy to learn and use.  Most important is that Python is Open Source, its free to use.

Is Python Object Oriented Language?

Yes, Python is Object Oriented Programming language. we can create classes and methods. Python has all features of OOPS like encapsulation, Inheritance, Polymorphism, Composition etc.

How to check the Python version?

To check the Python version, open your command prompt and type Python.


it will display the installed python version.


How to write comments in Python?

In Python, comments are written by using hash (#).  Characters or words written after hash # will consider as comments and Python will not execute that words or line

var="Python tutorial for beginners"

#this is comment line



Python tutorial for beginners

How to write multi line comments in Python?

Multi line comments in Python are written with triple double quotes “””. when we write three times “”” its consider as multi line comments.


var="Python tutorial for beginners"

"""this is multiline comment line 1

this is multiline comment line 2

this is multiline comment line 3"""




Python tutorial for beginners


What is PIP in Python?

PIP is Package Management in Python. Full form of PIP is Package Index.  PIP helps us to install the desired package into our system


How to check PIP version?

To check the pip version, Type pip –version in command prompt.

pip --version

What is Python library?

Python library is a collection of functions and modules of functionalities , so that you need not to write any code for that functionalities. you just to import that library to use functionalities.

What is difference between list and tuple?

  • Lists are dynamic in nature, where as tuples are fixed length.
  • we can modify the list after it creation, where as tuples van not be changed.
  • list can be initiated with square brackets [] e.g. numbers=[1,2,3], where as tuple are initiated with square brackets () e.g. numbers=(1,2,3)
  • Python tuples are faster than list.

What is difference between list and sets?

  • First difference is syntax. list are declared with square bracket(), where as sets are declared with curly brackets {}
  • lists contain duplicate elements where as sets can not have duplicate elements.

What is the use of Dict keyword?

dict is used to create dictionary in Python.


What are Keywords ? Name few Keywords in Python.

keywords are reserved words in every programming language, In Python Programming also there are keywords. few keywords  are:

  • True
  • False
  • del
  • and
  • if

What are iterators in Python?

Iterators are those Python types which are used to iterate in loop. tuple, lists, sets, dictionary are iterators as they are used with Python loop to iterate.

What is slicing in Python ?

Slicing is the way to get small portion of anything. In Python, Slicing means to get few elements from large python type like list tuple. slice() method is used for this.  in nutshell, it return slice from some Python object.

In slice(start, end, step), we have to tell from  where we have to start and end.

What is docstring in Python?

docstring is the coding standard to write comments at the starting of function or module. It like document something about the functionality of some function or some piece of code.

How to convert String to number?

In Python, String can be convert to int by using int() function.

print("type of a is",type(a))

print("value of num is:",num)

print("type of num is:",type(num))


type of a is <class 'str'>
type of num is: <class 'int'>


How to convert number to String

using str() function in Python, we can convert integer to String.

print("type of a is",type(a))

print("value of age is:",age)

print("type of age is:",type(age))


type of a is <class 'int'>
value of age is: 10
type of age is: <class 'str'>


How to convert list to tuple?

To convert list to tuple, just pass the list as the argument to tuple(list_name) function. see below


print("tuple elements are:", tuple1)


<class 'list'>
<class 'tuple'>
tuple elements are: (1, 2, 3)


What is the use of range function?

range function generate the sequence of integer numbers. Its Python built-in function. it start from 0 by default and increment by 1 by default.

for num in range(8):
print (num)




How to import the module in Python?

import keyword at the top of the Python program is used to import any module.

e.g import datetime to import date time functionality into the program.

Name few Python built-in function?

abs(), all(), ascii(), any(), bin() , dict() are few Python built-in functions.

How to take input from user through  console?

using input() function , we can take input from user.