1) What is Python?

Ans: Python is a high-level, interpreted, general-purpose programming language. It is an object oriented programming language and is used across industry for several purpose like Application Development, Data Science, Analytics, Machine Learning, Web Development, Games Development, etc.

2) What are the different data types Python?

Data types in python are:

– Numbers

– Strings

– Lists

– Tuples

– Dictionary

3) What is the difference between Python arrays and lists?

Arrays can only contain elements of same data types i.e., data type of array should be homogeneous.

Lists can contain elements of different data types i.e., data types of lists can be heterogeneous. 

4) Explain mutable and immutable objects?

Mutable objects: Objects that allow modifying their contents are called mutable objects. Like lists, sets, and dictionary are the example of mutable objects.

Immutable objects: Objects that don’t allow modifying their contents are called immutable objects. Like booleans, integers, floats,  strings, and tuples are the example of immutable objects.

5) What is lambda in Python?

Lambda is an anonymous function in Python. It can accept any number of arguments, but can only have a single expression. We use lambda function in a situation when we need an anonymous function for a short time period.


my_sum=lambda x,y:x+y

6) What is the key difference between lists and tuples?

Lists and tuples are both sequence data types.

Lists are represented with square brackets [ ] , while tuples are represented with parentheses.

The key difference between the two is that, lists can be modified or appended but tuples cannot be modified or appended.


7) Can you name ten built-in functions in Python?

print() – prints the output on the screen

float() – returns a floating point number

int() – returns an integer number

len() – returns the length of an object

input() – prompts for taking user input

list() – returns a list

abs() – returns the absolute value of a number

round() – rounds a number

type() – returns the type of an object

str() – returns a string object


8) How would you round a number to 2 decimal places?



output: 8.54

9) Name the libraries you have used while working on data?

Some of the libraries that are used while working on data are:

pandas (to work on data: cleansing, preparation, etc.O

numpy (to work on ndarray)

sklearn (for macine learning)

matplotlib (plotting data)

datetime (to deal with date and time)

10) What is the difference between loc and iloc?

Both loc and iloc are used for data selection operation on dataframs. 

loc is label-bases while iloc is integer index based. 

Which means, while using loc we have to specify rows and columns based on their row and column labels.  

While using iloc, we need to specify rows and columns by their integer index. 




11) How will you get all the keys from the dictionary?


12) How will you get all the values from the dictionary?


13) How will capitalize the first letter of a string?



print(stu) #output: John


15) What is the difference between concat() and append()?

pd.concat() is used to combine (bind) the columns in a dataframe while appent is used to add (append) data in the dataframe,

16) List the useful methods that are used while working on data in pandas?

Some of the useful methods are:









17) What is the difference between a function and a method?

A function is a block of code that performs a specific task.


print(“Hello Python”)  #print is a function

A method is like a Python function but it is called on an object.



city.upper() #upper is a method used on city object



Leave A Comment

All fields marked with an asterisk (*) are required