Built-In Function: Mathematical Operations
Learn how to perform different mathematical operations using built-in functions.
We'll cover the following...
Built-in functions in a programming language are very useful and can be a huge advantage in day-to-day tasks since we don’t have to write them ourselves . Python has a lot of functions built into it that are always available. Similarly, PowerShell has access to .Net classes that brings some useful functions as well. In this lesson, we are going to cover various built-in functions provided by PowerShell and Python.
Basic Mathematical Operations
We’ll come across various day-to-day tasks where it is required to perform basic mathematical operations. Let’s look into them one at a time.
Constants: PI and E
Mathematical constant Pi = 3.141592
and Euler’s number(e = 2.718281
) can be accessed in PowerShell using the System.Math
class. This has static properties holding values of these constants as shown in the following example.
[math]::PI[math]::E
Likewise, Python has a math
module that can be utilized to access the values of ...