Python math.factorial()

The Python installation comes with its own library of functions. The factorial function math.factorial() is included with its math module. Math modules are part of the Python install code package. Math modules or functions such as factorial, square root, sine, and exponential may be used in Python programs. To use them, the import command must … Read more

Python __irshift__() Magic Method

Syntax object.__irshift__(self, other) The Python __irshift__() magic method implements in-place bitwise right-shift operation x >>= y that calculates the right-shift operation x >> y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first … Read more

Python __ilshift__() Magic Method

Syntax object.__ilshift__(self, other) The Python __ilshift__() magic method implements in-place bitwise left-shift operation x <<= y that calculates the left-shift operation x << y, and assigns the result to the first operands variable x. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first … Read more

Reading and Writing JSON with Pandas

In this tutorial, we will learn how to transform a JSON object into a Pandas data frame and the other way around. For these approaches, we will have a look at the Pandas functions read_json() and to_json(). Working with JSON objects in Pandas is a very essential skill because we often find data stored in … Read more

Python __imatmul__() Magic Method

Syntax object.__imatmul__(self, other) The Python __imatmul__() magic method implements in-place matrix multiplication x @= y that calculates the matrix multiplication of the two operands and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When … Read more

Python Black-Scholes Model and the Basics of Option Pricing

?Β Part I: Risk-neutral valuation, Monte Carlo integration vs. the Black-Scholes formula You can find the code in the GitHub repository for this article. The Black-Scholes (BS) pricing model is still a de facto standard method of pricing financial options. Even though there has been much research into improved and possibly more realistic models, the fact … Read more

What is “payable” in Solidity?

In Solidity, we can use the keyword payable to specify that an address or a function can receive Ether. This article shows you how it works and how we can use it. Ethereum Accounts and Transactions Each Ethereum account, either an external account (human) or a contract account, has a balance that shows how much … Read more

Python __imul__() Magic Method

Syntax object.__imul__(self, other) The Python __imul__() magic method implements in-place multiplication x *= y that multiplies the operands with each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x … Read more

Python __isub__() Magic Method

Syntax object.__isub__(self, other) The Python __isub__() magic method implements in-place subtraction x -= y that subtracts the operands from each other and assigns the result to the left operand. This operation is also called augmented arithmetic assignment. The method simply returns the new value to be assigned to the first operand. When you call x … Read more