How much bigger is a 16-inch pizza compared to an 8-inch pizza? A more pragmatic question is: How many 8-inch pizzas "fit" in a 16-incher?

The answer, as it turns out, is exactly four 8-inch pizzas. For sizes that don't correspond to a round number of 8-inchers, you must round the number of slices (one 8-inch pizza = 8 slices), e.g.:

```python
how_many_pizzas(16) -> "pizzas: 4, slices: 0"
how_many_pizzas(12) -> "pizzas: 2, slices: 2"
how_many_pizzas(8) -> "pizzas: 1, slices: 0"
how_many_pizzas(6) -> "pizzas: 0, slices: 4"
how_many_pizzas(0) -> "pizzas: 0, slices: 0"
```
Get coding quick, so you can choose the ideal size for your next meal!

Source: codewars | Difficulty: EASY
Tags: Geometry

Fundamentals

Mathematics

Starter code: def how_many_pizzas(n):
	

Solutions:
def how_many_pizzas(n):
	return 'pizzas: {}, slices: {}'.format(*divmod(n * n // 8, 8))


def how_many_pizzas(n):
	(pizzas, slices) = (int(n) for n in divmod(n ** 2, 64))
	return f'pizzas: {pizzas}, slices: {slices // 8}'


def how_many_pizzas(n):
	(q, r) = divmod(n ** 2, 8 ** 2)
	return f'pizzas: {q}, slices: {round(r / 8)}'


def how_many_pizzas(n):
	return f'pizzas: {n * n // 8 ** 2}, slices: {n * n / 8 % 8:.0f}'


def how_many_pizzas(n):
	pizzas = n * n / 64
	p = int(pizzas)
	s = int((pizzas - p) * 8)
	return f'pizzas: {p}, slices: {s}'


def how_many_pizzas(n):
	area = n * n
	eight_area = 64
	total_pizzas = int(area / eight_area)
	slices = 0
	if area % eight_area != 0:
		slices = int((area - total_pizzas * eight_area) / 8)
	return 'pizzas: {}, slices: {}'.format(total_pizzas, slices)


def how_many_pizzas(n):
	return 'pizzas: {}, slices: {}'.format(n ** 2 // 8 ** 2, n ** 2 % 8 ** 2 // 8)


import math

def how_many_pizzas(n):
	x = math.floor(n * n / 64)
	w = round(n * n % 64 / 8)
	return f'pizzas: {x}, slices: {w}'


def how_many_pizzas(n):
	return f'pizzas: {n ** 2 // 8 ** 2}, slices: {round((n ** 2 / 8 ** 2 - n ** 2 // 8 ** 2) * 8)}'


def how_many_pizzas(n):
	return f'pizzas: {n ** 2 // 64}, slices: {n ** 2 % 64 // 8}'