Generator in python is a function which returns an iterator. It looks like a normal function except that it contains yield statements
Tag: Python FAQ
Important Python interview questions for freshers and experienced
What is triple-quoted string in python?
Triple quoted string in python is a string which is bound by three instances of either a quotation mark (”)
What is universal newlines in python?
Universal newlines in python is a manner of interpreting text streams in which all of the following are recognized as
What __slots__ does?
–slot– is a declaration inside a class that saves memory by pre-declaring space for instance attributes and eliminating instance dictionaries.
What is ested scope in python?
ested scope in python is the ability to refer to a variable in an enclosing definition. For instance, a function
What is namespace?
Namespace is the place where a variable is stored. Namespaces are implemented as dictionaries. There are the local, global and
What is mutable and immutable in python?
Mutable objects can change their value but keep their id(). Immutable is an object with a fixed value. Immutable objects include
What is named tuple in python?
Any tuple-like class whose indexable elements are also accessible using named attributes (for example, time.localtime() returns a tuple-like object where the year is accessible
What is metaclass in python?
Metaclass is the class of a class. Class definitions create a class name, a class dictionary, and a list of
What is list comprehension in Python?
List comprehension is a compact way to process all or part of the elements in a sequence and return a
What this command tells to operating system ” #! /usr/bin/env python3 “ ?
This is not technically a part of the program. It is there to tell the operating system what version of
How Python is interpreted?
Python language is an interpreted language. The Python program runs directly from the source code. It converts the source code
What is Python interpreter?
The interpreter operates somewhat like the Unix shell: when called with standard input connected to a tty device, it reads
What is IDLE?
An Integrated Development Environment for Python. IDLE is a basic editor and interpreter environment which ships with the standard distribution