Question: What is current Stable version of Python?
Version: 3.5.1 Dated: 7 December 2015
Question: What is Filename extension of Python?
py, .pyc, .pyd, .pyo, pyw, .pyz
Question: What is offical website of Python?
Question: What is the difference between deep copy and shallow copy?
- Shallow copy is used when a new instance type gets created and it keeps the values that are copied.
Deep copy is used to store the values that are already copied.
- Shallow copy is used to copy the reference pointers just like it copies the values.
- Shallow copy allows faster execution of the program whereas deep copy makes slow.
Question: How to use ternary operators?
[on_true] if [expression] else [on_false] x, y = 25, 50 big = x if x < y else y
Question: What are different data-type in Python?
Question: What is module in python?
Module is set of related functionalities. Each python program file is a module, which imports other modules to use names they define using object.attribute notation.
Question: What is lambda in python?
lamda is a single expression anonymous function often used as inline function.
Question: How to validate Email Address in python?
Question: What is pass in Python?
pass is no-operation Python statement and used to indicate nothing to be done.
Question: What is iterators?
iterators is used iterate over a group of elements, containers, like list
Question: What is slicing in Python?
Slicing is a mechanism to select a range of items from Sequence types like strings, list, tuple, etc.
Question: What is docstring in Python?
Python documentation string is a way of documenting Python modules, functions, classes. PEP 257 standardize the high-level structure of docstrings.
Question: Name few modules that are included in python by default?
- re (regular expressions)
Question: What is list comprehension?
Creating a list by doing some operation over data that can be accessed using an iterator.
>>>[ord(i) for i in string.ascii_uppercase] [65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90] >>>
Question: What is map?
MAP executes the function given as the first argument on all the elements of the iterable given as the second argument.
Question: What is the difference between a tuple and a list?
A tuple is immutable i.e. can not be changed. It can be operated on only.
List is mutable. Changes can be done internally to it.
Question: How to Remove white spaces from string?
filter(lambda x: x != ' ', s)