Month: June 2021

Python Multiplication Operator

Python’s multiplication operator * multiplies two objects. The semantics of the multiplication depends on the operands’ data types. For example, multiplying two integers performs arithmetic multiplication whereas multiplying a list with an integer performs list concatenation. The specific return value of the multiplication operator is defined in a data types’ __mul__() magic method. Have a …

Python Multiplication Operator Read More »

The $31,000,000 Bitcoin Valuation Thesis

In this article, I’ll develop a simple model on how to value Bitcoin. Valuation thesis: Bitcoin will replace the SWIFT bank-to-bank settlement protocol. Valuation methodology. Bitcoin is now the largest, most decentralized, and most secure international monetary network in the world. This makes it a perfect candidate for bank-to-bank settlements of high-value transactions. Currently, these …

The $31,000,000 Bitcoin Valuation Thesis Read More »

[Google Interview] Find All Numbers That Disappeared in an Array

🏗️ Company Tags: Google Problem Formulation Given an array nums of n integers. Return an array containing all the integers in the range[1, n]that do not appear in nums. ✒️ Here, nums[i] is in the range [1, n]. ⚠️Constraints: n == nums.length 1 <= n <= 105 1 <= nums[i] <= n 💡Examples Let’s have a look at some examples …

[Google Interview] Find All Numbers That Disappeared in an Array Read More »

Python Addition Operator

Python provides the addition operator + to add two objects. The semantics of the addition depends on the operands’ data types. For example, adding two integers perform arithmetic addition whereas adding two lists performs list concatenation. The specific return value of the addition operator is defined in a data types’ __add__() magic method. Have a …

Python Addition Operator Read More »

How to Generate a Random String in Python?

Problem Formulation You are tasked with writing Python code to generate a random string.  The string should contain any of the printable characters on your keyboard.  Letters, numbers, and punctuation marks are valid, and we’ll leave out any whitespace characters. What’s the best way to solve this in Python? Method 1: List Comprehension and random.randint() …

How to Generate a Random String in Python? Read More »

K-Nearest Neighbors (KNN) with sklearn in Python

The popular K-Nearest Neighbors (KNN) algorithm is used for regression and classification in many applications such as recommender systems, image classification, and financial data forecasting. It is the basis of many advanced machine learning techniques (e.g., in information retrieval). There is no doubt that understanding KNN is an important building block of your proficient computer …

K-Nearest Neighbors (KNN) with sklearn in Python Read More »

Python Equal To

The Python equal to (left==right) operator returns True when its left operand is equal to its right operand. Otherwise, it returns False. For example, 3==3 evaluates to True, but 3==2 evaluates to False. Examples Let’s explore a couple of examples regarding the equal to operator. Is 3 equal to 2? What about ‘h’ equal to …

Python Equal To Read More »