The year is 2088 and the Radical Marxist Socialist People's Party (RMSPP) has just seized power in Brazil.

Their first act in power is absolute wealth equality through coercive redistribution.

Create a function that redistributes all wealth equally among all citizens.

Wealth is represented as an array/list where every index is the wealth of a single citizen. The function should mutate the input such that every index has the same amount of wealth. **MUTATE the input array/list, don't return anything.**

See example:

```python
wealth = [5, 10, 6]  # This represents:
                     # citizen 1 has wealth 5
                     # citizen 2 has wealth 10
                     # citizen 3 has wealth 6
                     
redistribute_wealth(wealth) # mutates wealth list
wealth => [7, 7, 7] # wealth has now been equally redistributed

```

Info:

- **MUTATE the input array/list, don't return anything**

- Input is garantueed to hold at least 1 or more citizens

- Wealth of citizen will an integer with minimum 0 (negative wealth not possible)

- Handling of floating point error will not be tested

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def redistribute_wealth(wealth):
	

Solutions:
def redistribute_wealth(wealth):
	wealth[:] = [sum(wealth) / len(wealth)] * len(wealth)


from statistics import mean

def redistribute_wealth(wealth):
	avg = mean(wealth)
	for i in range(len(wealth)):
		wealth[i] = avg


from numpy import mean

def redistribute_wealth(wealth):
	wealth[:] = [mean(wealth)] * len(wealth)


def redistribute_wealth(w):
	w[:] = [sum(w) / len(w)] * len(w)


def redistribute_wealth(wealth):
	wealth[:] = len(wealth) * [sum(wealth) / float(len(wealth))]


def redistribute_wealth(wealth):
	val = sum(wealth) / len(wealth)
	wealth[:] = map(lambda x: val, wealth)


def redistribute_wealth(wealth):
	mean = sum(wealth) / len(wealth)
	wealth[:] = [mean] * len(wealth)


def redistribute_wealth(a):
	n = len(a)
	x = sum(a) / n
	a.clear()
	for _ in range(n):
		a.append(x)


def redistribute_wealth(wealth):
	mean = sum(wealth) / len(wealth)
	for (i, x) in enumerate(wealth):
		wealth[i] = mean


def redistribute_wealth(wealth):
	s = sum(wealth) / len(wealth)
	for i in range(len(wealth)):
		wealth[i] = s