Skip to content

Category Archives: Python

Difficulty level : Intermediate Predict the output of following Python Programs. Program 1: class Geeks:     def __init__(self, id): = id    manager = Geeks(100)… Read More
In Python, Assignment statements do not copy objects, they create bindings between a target and an object. When we use = operator user thinks that… Read More
Import in python is similar to #include header_file in C/C++. Python modules can get access to code from another module by importing the file/function using… Read More
Predict the output of following python programs: Program 1: r = lambda q: q * 2 s = lambda q: q * 3 x =… Read More
reload() reloads a previously imported module. This is useful if you have edited the module source file using an external editor and want to try… Read More
Javascript Object Notation abbreviated as JSON is a light-weight data interchange format. It Encode Python objects as JSON strings, and decode JSON strings into Python… Read More
In python, dictionaries are containers which map one key to its value with access time complexity to be O(1). But in many applications, the user… Read More
Python contains a container called “ChainMap” which encapsulates many dictionaries into one unit. ChainMap is member of module “collections“. Example: # Python program to demonstrate  … Read More
Python supports a type of container like dictionaries called “namedtuple()” present in module, “collections“. Like dictionaries they contain keys that are hashed to a particular… Read More
Enumerations in Python are implemented by using the module named “enum“.Enumerations are created using classes. Enums have names and values associated with them.Properties of enum:1.… Read More
Heap data structure is mainly used to represent a priority queue. In Python, it is available using “heapq” module. The property of this data structure… Read More
Deque (Doubly Ended Queue) in Python is implemented using the module “collections“. Deque is preferred over list in the cases where we need quicker append… Read More
An Artificial Neural Network (ANN) is an information processing paradigm that is inspired the brain. ANNs, like people, learn by example. An ANN is configured… Read More
Quine is a program which takes no input but outputs a copy of its own code. We have discussed quine in C. The shortest possible… Read More
The purpose of Bisect algorithm is to find a position in list where an element needs to be inserted to keep the list sorted. Python… Read More