Python __floordiv__() Magic Method

Syntax object.__floordiv__(self, other) The Python __floordiv__() method implements the integer division operation // called floor division—as opposed to the true division operation /. For example to evaluate the expression x // y, Python attempts to call x.__floordiv__(y). If the method is not implemented, Python first attempts to call __rfloordiv__ on the right operand and if … Read more

How to Select a Drop-Down Menu Value with Python Selenium

One of the finest open-source browser automation tools recognized in today’s world is selenium and the β€œSelect” class of selenium WebDriver enables us to handle the dropdown menu smoothly. Today, we will try to figure out all the intricacies of the β€œSelect” class practically. Purpose of the Select Class The β€œSelect” class in selenium allows … Read more

[Google Interview] License Key Formatting

[toc] Company tags: Google, Capital One Problem Formulation You are given a license key represented as a string s that consists of only alphanumeric characters and dashes. The string is separated into n + 1 groups by n dashes. You are also given an integer k. We want to reformat the string s such that … Read more

Python Read Binary File

During your career as a Pythonista, you will most likely find yourself required to work with binary data. See the examples outlined below to efficiently read/write to a Binary file. Preparation Before any data manipulation can occur, one (1) new library will require installation. The NumPy library supports multi-dimensional arrays and matrices in addition to … Read more

How to Use Pytest Fixtures

In this article, you’ll deep dive into a powerful testing feature in Python called Pytest Fixtures. Feel free to dive into our background articles on Pytest in case you need a quick refresher (with video)! Pytest – A Complete Overview Pytest – How to Run Tests Efficiently You can watch this tutorial in video format … Read more

The Quickselect Algorithm – A Simple Guide with Video

What is the Quickselect algorithm? The Quickselect algorithm is a computer algorithm designed to find the kth (e.g. smallest or largest) element from an unordered list. It is based on the idea behind the Quicksort algorithm, invented by the same author, Sir Charles Anthony Richard (Tony) Hoare. Here, k stands for the index of an … Read more

Python __truediv__() Magic Method

Syntax object.__truediv__(self, other) The Python __truediv__() method is called to implement the normal division operation / called true division—as opposed to the floor division operation //. For example to evaluate the expression x / y, Python attempts to call x.__truediv__(y). We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). To … Read more

Python __matmul__() Magic Method

Syntax object.__matmul__(self, other) The Python __matmul__() method is called to implement the matrix multiplication operation @. For example to evaluate the expression x @ y, Python attempts to call x.__matmul__(y). We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). To get a list of all dunder methods with explanation, check … Read more

How To Create a Two Dimensional Array in Python?

[toc] Introduction Today we can see 2D arrays used everywhere. As simple examples – chessboard, eggs arranged in a rectangular egg-holder are 2D arrays. In the world of computers, we use 2D arrays everywhere. 2D arrays are used in Image processing, Surveys, Speech Processing, Geoscience, Tables, Databases, Graphs, etc.  What is a Dimension in an … Read more

Python __mul__() Magic Method

Syntax object.__mul__(self, other) The Python __mul__() method is called to implement the arithmetic multiplication operation *. For example to evaluate the expression x * y, Python attempts to call x.__mul__(y). We call this a “Dunder Method” for “Double Underscore Method” (also called “magic method”). To get a list of all dunder methods with explanation, check … Read more