```if-not:sql
Implement a function that receives two IPv4 addresses, and returns the number of addresses between them (including the first one, excluding the last one).
```

```if:sql
Given a database of first and last IPv4 addresses, calculate the number of addresses between them (including the first one, excluding the last one).

## Input

~~~
---------------------------------
|     Table    | Column | Type  |
|--------------+--------+-------|
| ip_addresses | id     | int   |
|              | first  | text  |
|              | last   | text  |
---------------------------------
~~~

## Output

~~~
----------------------
|   Column    | Type |
|-------------+------|
| id          | int  |
| ips_between | int  |
----------------------
~~~
```

All inputs will be valid IPv4 addresses in the form of strings. The last address will always be greater than the first one.

___

## Examples

```python
ips_between("10.0.0.0", "10.0.0.50")  ==   50 
ips_between("10.0.0.0", "10.0.1.0")   ==  256 
ips_between("20.0.0.10", "20.0.1.0")  ==  246
```

Source: codewars | Difficulty: EASY

Starter code: def ips_between(start, end):
	

Solutions:
from ipaddress import ip_address

def ips_between(start, end):
	return int(ip_address(end)) - int(ip_address(start))


def ips_between(start, end):
	a = sum([int(e) * 256 ** (3 - i) for (i, e) in enumerate(start.split('.'))])
	b = sum([int(e) * 256 ** (3 - i) for (i, e) in enumerate(end.split('.'))])
	return abs(a - b)


from ipaddress import IPv4Address

def ips_between(start, end):
	return int(IPv4Address(end)) - int(IPv4Address(start))


ips_between = lambda s, e: sum(((int(i[0]) - int(i[1])) * j for (i, j) in zip(zip(e.split('.'), s.split('.')), [16777216, 65536, 256, 1])))


def value(x):
	x = x.split('.')
	return int(x[0]) * 256 ** 3 + int(x[1]) * 256 ** 2 + int(x[2]) * 256 + int(x[3])

def ips_between(start, end):
	return value(end) - value(start)


def ips_between(start, end):
	difference = [int(b) - int(a) for (a, b) in zip(start.split('.'), end.split('.'))]
	sum = 0
	for d in difference:
		sum *= 256
		sum += d
	return sum


def ips_between(start, end):
	n1 = int(''.join((f'{n:08b}' for n in map(int, start.split('.')))), 2)
	n2 = int(''.join((f'{n:08b}' for n in map(int, end.split('.')))), 2)
	return n2 - n1


def ips_between(start, end):
	x = []
	x = start.split('.')
	y = []
	u = []
	y = end.split('.')
	for i in range(4):
		u.append(int(y[i]) - int(x[i]))
	t = u[-1]
	for i in range(1, 4):
		t += u[-1 - i] * 256 ** i
	return t


import ipaddress

def ips_between(start, end):
	one = int(ipaddress.IPv4Address(start))
	two = int(ipaddress.IPv4Address(end))
	return two - one