December 2018
Beginner to intermediate
796 pages
19h 54m
English
Python gives you complex numbers support out of the box. If you don't know what complex numbers are, they are numbers that can be expressed in the form a + ib where a and b are real numbers, and i (or j if you're an engineer) is the imaginary unit, that is, the square root of -1. a and b are called, respectively, the real and imaginary part of the number.
It's actually unlikely you'll be using them, unless you're coding something scientific. Let's see a small example:
>>> c = 3.14 + 2.73j>>> c.real # real part3.14>>> c.imag # imaginary part2.73>>> c.conjugate() # conjugate of A + Bj is A - Bj(3.14-2.73j)>>> c * 2 # multiplication is allowed(6.28+5.46j)>>> c ** 2 # power operation as well(2.4067000000000007+17.1444j)>>> d = ...
Read now
Unlock full access