Python math
From wikinotes
(Redirected from Python Math)
I'm no mathematician, and I severely doubt that I'll use anywhere near all of the math modules that python is capable of using. I think as I get more into 3D engines, this may play an important role.
Basic Math
## Arithmetic var = 1 + 3 - 1 var = 4 / 2 *4 var = 13 // 4 ## division without remainder var = 13 % 4 ## remainder only ## Exponents
iterations
import itertoolspermutations every possible combination of a number without repetition (ex: single dice)
import itertools for i in itertools.permutations('ABCD', 2) : print iCartesian Product Every possible combination of a number with repeating numbers (ex: multiple dice)
import itertools for i in itertools.product('ABCD', repeat=2) : print i