**Build-in types**

Numeric Types | Precision | Internally | Literal Creation | |
---|---|---|---|---|

integers | Have unlimited precision | i = 5 | ||

floating point | System dependent precision values check – sys.float_info | implemented using double in C |
f = 5.5 | |

complex numbers | real + img | implemented as floating point number | c = 2j |

- c = 2j Yields an imaginary number (a complex number with a zero real part) add to an integer or float to get a complex number with real and imaginary parts.

**Operations on Numeric Types**

Operation | Result | ||
---|---|---|---|

x + y |
sum of x and y |
||

x - y |
difference of x and y |
||

x * y |
product of x and y |
||

x / y |
quotient of x and y |
||

x // y |
floored quotient of x and y |
||

x % y |
remainder of x / y |
||

-x |
x negated |
||

+x |
x unchanged |
||

abs(x) |
absolute value or magnitude of x |
||

int(x) |
x converted to integer |
||

float(x) |
x converted to floating point |
||

complex(re, im) |
a complex number with real part re, imaginary part im. im defaults to zero. |
||

c.conjugate() |
conjugate of the complex number c |
||

divmod(x, y) |
the pair (x // y, x % y) |
||

pow(x, y) |
x to the power y |
||

x ** y |
x to the power y |

Strings *

- Methods that use dot notation only work with strings.

- On the other hand,
`len()`

and`str()`

can work on other data types