You are on page 1of 2

1. What is the difference between set and list?

SET LIST
A set is a collection which is unordered and unindexed,
List
and
is a collection which is ordered and changeable. Allows
doesn’t allow duplicates duplicate members.
A set does not support slicing. A list supports slicing

A set is mutable also iterable A list is mutable also iterable

Faster to lookup items Slightly faster to iterate over item

No duplicates Duplicates exist

Example: my_set = {1, 2, 3} Example: list1 = [1, 2, 3]

2. What is the difference between list and tuple?

LIST TUPLE
It is mutable It is immutable

Consumes more memory Consumes less memory

Many built-in methods are available Doesn’t have many built-in methods

Unexpected errors and changes can easily occur in lists.


Unexpected errors and changes rarely occur

Operations like insertion and deletion are better performed


Elements can be accessed better

The implication of iterations is time-consuming Implications of iterations are much faster in


in the list tuples

3. What do you understand by dictionary in python?

A Dictionary in Python is the unordered and changeable collection of data values that holds key-value pairs.
Dictionary keys are case sensitive. Same key name but with the different cases are treated as different keys in
Python dictionaries. Each key-value pair in the dictionary maps the key to its associated value making it more
optimized. A Dictionary in python is declared by enclosing a comma-separated list of key-value pairs using
curly braces({}). Python Dictionary is classified into two elements: Keys and Values.
4. What do you mean by pipelining in python?
It is used to chain multiple estimators into one and hence, automate the machine learning process. This is
extremely useful as there are often a fixed sequence of steps in processing the data. Some codes are meant to
transform features- normalise numerical or turn text into vectors, or fill up missing data, they
are transformers. Other codes are meant to predict variables by fitting an algorithm such as a random forest or
support vector machine (SVM), they are estimators.
5. What is boxing-unboxing in python?
Boxing is the process of wrapping the primitive data type value into Wrapper Class object using any Wrapper
Class.
Unboxing is the process of unwrapping the wrapped Wrapper Class object back to the primitive data type value.

You might also like