Title: Mathematical Operations
Slug: math_operations
Summary: Mathematical Operations
Date: 2016-05-01 12:00
Category: Python
Tags: Basics
Authors: Chris Albon
In [5]:
import math
In [6]:
math.pi
Out[6]:
In [7]:
math.e
Out[7]:
In [8]:
math.sin(2 * math.pi / 180)
Out[8]:
In [9]:
2 ** 4, pow(2, 4)
Out[9]:
In [10]:
abs(-20)
Out[10]:
In [11]:
sum((1, 2, 3, 4))
Out[11]:
In [12]:
min(3, 9, 10, 12)
Out[12]:
In [13]:
max(3, 5, 10, 15)
Out[13]:
In [14]:
math.floor(2.949)
Out[14]:
In [15]:
math.trunc(32.09292)
Out[15]:
In [16]:
int(3.292838)
Out[16]:
In [17]:
round(2.943), round(2.499)
Out[17]:
In [18]:
round(2.569, 2)
Out[18]: