There are several types of numbers in the Python programming language. Their uses depend on the context of the problem.

The first are integers. Here, we have a whole number that may be preceeded by a plus or minus sign.

```
> 2
2
> -3
-3
```

These values are equivalent to scientific notation. They are made up of digits, and an `e`

followed by an exponent.

```
> 2e4
200000.0
> 4e-3
0.004
> 0.0000001
1e-07
```

You may also specify numbers in hexadecimal notation, using base 16 instead of base 10. For values from 10 to 16, use letters A to F.

```
> 0x3F # (3 x 16) + (15 * 1)
63
> 0xFFFFFF
16777215
```

So what happens if you combine two numbers of different type? If you try it out, you can see that our result will be of the type that carries more precision. Thus, if we add a float and an int, we obtain a float.

```
> 3.4//3
1.0 # Floored, but still a float.
```

We may represent imaginary numbers by adding either a `j`

or `J`

to our expression.

```
> 5+3j
(5+3j)
```

So what happens if you combine two numbers of different type? If you try it out, you can see that our result will be of the type that carries more precision. Thus, if we add a float and an int, we obtain a float.

```
> 3.4//3
1.0 # Floored, but still a float.
```

Here are some useful functions that can be used with numbers.

- abs(
`val`) - Absolute value of number.
- max(
`val`) - Maximum of a set of numbers.
- min(
`val`) - Minimum of a set of numbers.
- int(
`val`) - Convert number (or string) to an integer.
- float(
`val`) - Convert number (or string) to a float.
- bool(
`val`) - Convert to a boolean.
- 0 is False, all else is True.
- str(
`val`) - Convert to a string.

This book is designed to be used as the primary textbook in a college-level first course in computing. It takes a fairly traditional approach, emphasizing problem solving, design, and programming as the core skills of computer science. However, these ideas are illustrated using a non-traditional language, namely Python.

$ Check price(211+ reviews)

Stretch out your back and relieve your back muscles with inversion therapy. This device counteracts the forces of gravity on the body by decompressing and elongating the spine. By using this product just ten minutes a day, you can be well on your way to improved circulation and posture while relieving muscle aches, back pain and stress.

$$ Check price(1,700+ reviews)

Ad