Safa Mulani

An enthusiast in every forthcoming wonders!

Python OrderedDict

OrderedDict is a subclass of the dictionary, which maintains the order in which the elements/items are added to it. OrderedDict preserves the order of insertion of the elements. A default dict does not save the order and results in the iteration in an arbitrary order. Initially, we need to import the collections module to use the […]

Python OrderedDict Read More »

Python inspect module

Python’s inspect module provides the introspection of live objects and the source code of the same. It also provides the introspection of the classes and functions used throughout the program. The inspect module provides the user to make use of functions/methods in it to fetch the source code for the same, extract and parse the

Python inspect module Read More »

Python Pendulum Module

Python’s pendulum module enables date/time conversions and manipulations. It helps the user to work easily with date/time formats. This module enables and provides all the functionalities provided by the pytz module. Installation of pendulum module through the command-line: Importing pendulum module: Display the current time The now() method is used to display the current date-time

Python Pendulum Module Read More »

Python arrow module

Python arrow module enables date-time manipulations. It helps create instances and manipulate the timestamp accordingly. It shows a user-friendly approach to deal with the date-time conversions. Features: Arrow module is supported by Python 2.7 and higher versions. Time-zone aware Parses the string automatically Full level implementation Installing the arrow module: pip install arrow Access the

Python arrow module Read More »

Python fractions Module

Python fractions module enables the user to manage fractions related computations in an efficient manner. This module enables us to create fractions from integers, floats, decimal, and strings. This fraction module supports rational number arithmetic operations. Basics of fractions module 1. Importing a fraction module: 2. Instantiate the fraction class: There are a number of

Python fractions Module Read More »

Python math Module

Python math module helps the user to get direct access to the mathematical functions in their program. Thus, it helps to solve and minimize complex computations. In order to avail the functionalities of the math module, we need to import it in our code using import math statement. The math module does not support Complex

Python math Module Read More »

Python Remove Spaces from String

Python provides various ways to remove white-spaces from a String. This article will focus of some of the efficient techniques to remove spaces from a String. Either of the following techniques can be used to get rid of the spaces from a string: By using strip() method By using replace() method By using join() with

Python Remove Spaces from String Read More »

Two Dimensional Array in Python

Array is basically a data structure that stores data in a linear fashion. There is no exclusive array object in Python because the user can perform all the operations of an array using a list. So, Python does all the array related operations using the list object. The array is an ordered collection of elements

Two Dimensional Array in Python Read More »

Python Stack

A Stack is a Last-In-First-Out Linear data structure i.e. the element entered at the last will be the first element to be removed. In stack, the items are added at one end and these items are removed from the same end. Operations associated with the Stack: Push – Addition of elements into the stack Pop

Python Stack Read More »