The accounts of the "Fat to Fit Club (FFC)" association are supervised by John as a volunteered accountant.
The association is funded through financial donations from generous benefactors. John has a list of
the first `n` donations: `[14, 30, 5, 7, 9, 11, 15]`
He wants to know how much the next benefactor should give to the association so that the 
average of the first `n + 1` donations should reach an average of `30`.
After doing the math he found `149`. He thinks that he made a mistake.
Could you help him?

if `dons = [14, 30, 5, 7, 9, 11, 15]` then `new_avg(dons, 30) --> 149`

The function `new_avg(arr, navg)` should return the expected donation
(rounded up to the next integer) that will permit to reach the average `navg`. 

Should the last donation be a non positive number `(<= 0)` John wants us to throw (or raise) an error or

- return Nothing in Haskell
- return None in F#, Ocaml, Scala
- return `-1` in C, Fortran,  Nim, PowerShell, Go, Prolog
- echo `ERROR` in Shell
- raise-argument-error in Racket

so that he clearly sees that his expectations are not great enough.

Notes: 

- all donations and `navg` are numbers (integers or floats), `arr` can be empty.
- See examples below and "Test Samples" to see which return is to be done.

```
new_avg([14, 30, 5, 7, 9, 11, 15], 92) should return 645
new_avg([14, 30, 5, 7, 9, 11, 15], 2) 
should raise an error (ValueError or invalid_argument or argument-error or DomainError) 
or return `-1` or ERROR or Nothing or None depending on the language.
```

Difficulty: EASY
Tags: Fundamentals

Data structures
Skill types: Data structures

Starter code:
def new_avg(arr, newavg):
	

Solutions:
from math import ceil

def new_avg(arr, newavg):
	value = int(ceil((len(arr) + 1) * newavg - sum(arr)))
	if value < 0:
		raise ValueError
	return value


def new_avg(arr, newavg):
	extra = newavg * float(len(arr) + 1) - sum(arr)
	if extra < 0:
		raise ValueError
	return int(extra + 0.999)


import math

def new_avg(arr, newavg):
	result = math.ceil(newavg * (len(arr) + 1) - sum(arr))
	if result <= 0:
		raise ValueError('error')
	else:
		return result


from math import ceil

def new_avg(arr, newavg):
	required = ceil(newavg * (len(arr) + 1) - sum(arr))
	assert required > 0
	return required


from math import ceil

def new_avg(arr, average):
	nums_sum = total_nums = 0
	for a in arr:
		nums_sum += a
		total_nums += 1
	donation = ceil(average * (total_nums + 1) - nums_sum)
	if donation > 0:
		return donation
	raise ValueError


from math import *

def new_avg(arr, newavg):
	v = ceil(newavg * (len(arr) + 1) - sum(arr))
	if v >= 0:
		return v
	else:
		raise ValueError


from math import ceil

def new_avg(lst, newavg):
	nxt = newavg * (len(lst) + 1) - sum(lst)
	if nxt <= 0:
		raise ValueError
	return ceil(nxt)


import math

def new_avg(arr, newavg):
	a = math.ceil(newavg * (len(arr) + 1) - sum(arr))
	if a > 0:
		return a
	return Error


import math

def new_avg(arr, newavg):
	new_donation = newavg * (len(arr) + 1) - sum(arr)
	if new_donation <= 0:
		raise 'Error'
	return math.ceil(new_donation)


def new_avg(arr, newavg):
	value = round(len(arr) * newavg - (sum(arr) - newavg) + 0.49)
	if value < 0:
		raise ValueError('Error expected')
	return value