# Importing Modules

The Math Module provides access to all mathematical functions in Python. We can import the Math module using the import command. The Random Module provides access to generating random numbers or items in a given set.

```
10
6
```

# Partial Imports

You can import the Math and Random Modules and other Python modules by using the import command.

## Partial Imports: Sqrt()

We can use the Sqrt function to find the square root of a given number, and returns it as a float. The Sqrt function is imported from the Math Module.

```
2.0
```

# Math Operations: **, %, /, //, +, -, *

We can use math operations from the Math Module with two given numbers. The ** operator to use exponents on a calculation. The % operator returns the remainder of a calculation. The / operator is a division calculation that returns a float. The // operator is a division calculation that returns an int. The + operator adds the two given numbers. The - operator subtracts the two given numbers. The * operator multiplies the two given numbers.

```
64
0
4.0
4
10
6
16
```

# Order of Operations

If we are calculating multiple numbers with more than one operator, we use the order of operations(parenthesis, exponents, multiplication/division, addition/subtraction).

```
59604644775390657
```

# Math Functions

Other Math functions that we need to know is pow, ceil, floor, trunc, and fabs. The pow function takes two arguments. The second number is the given power to the first number. The ceil function rounds a decimal up to the next whole number. The floor function rounds a decimal down to the nearest whole number. The trunc function deletes the remainder of a decimal. The fabs function finds the absolute value of a number.

```
32
14
13
13
7.0
```

# The Random Library

If you're coding a game or puzzle, you can use the shuffle, choice, randint, and randrange functions. The shuffle function mixes up items in a list. The randint function selects a random item in a list or range. The randrange function selects a random item in a range.

```
[18, 20, 7, 13, 14, 10, 15, 11, 1, 5, 3, 6, 2, 17, 16, 9, 19, 12, 4, 8]
5
3
```

# The Datetime Module

We can access current times and dates using the Datetime Module. We import the Datetime Module by using the import command.

## Time Objects(Hour, Minute, Second, Microsecond)

We can use the time function in the Datetime Module to figure out the current time or any time.

```
05:30:45.000333
```

## Date Objects(Year, Month, Day)

We can use the date function in the Datetime Module to figure out the current date or any date.

```
2021-12-20
```

## Timedelta Objects(weeks, days, hours, minutes, seconds, milliseconds, microseconds)

The timedelta function is used to show when an event should take place.

```
60 days, 15:20:00
```