milly-and-chocolates-4

Milly loves to eat chocolates. She buys only those food items which contain some amount  or percentage of chocolate in it. She has purchased N such food items and now she is planning to make a new food item by her own. She will take equal proportions of all of these N food items and mix them. Now she is confused about the  percentage of chocolate that this new food item will have. Since she is busy in eating the chocolates so you have to help her in this task.

Input
First line of the input will contain T (no. of test cases). Every test case will contain two lines. First line will contain N (no. of food items) and the second line will contain N space separated Pi values denoting the percentage of chocolate in i^th food item.

Output
For every test case, print the percentage of chocolate that will be present in the new food item. 

Note : Your answer should be exactly  upto 8 decimal places which means that if your answer is 2.357 then you have to print 2.35700000 or if your answer is 2.66666666 .... then you have to print 2.66666667

Constraints
1 ≤ T ≤ 5
1 ≤ N ≤ 5*10^5
0 ≤ Pi ≤ 100

SAMPLE INPUT
1
3
80 30 90

SAMPLE OUTPUT
66.66666667

Difficulty: EASY
Tags: Probability

Starter code:

Solutions:
test_cases = int(input())
for test_case in range(0, test_cases):
	number_of_choclates = int(input())
	percentage_string = input()
	percentage_array = percentage_string.split(' ', number_of_choclates - 1)
	sum = 0
	for percentage in percentage_array:
		sum += int(percentage)
	average = sum / float(number_of_choclates)
	print('%.8f' % average)


test_cases=int(input(""))
result=[]
for i in range(test_cases):
	item_number=int(input(""))
	items=input("").split(" ")[:item_number]
	item_number=float(item_number)
	items=list(map(float,items))
	total=sum(items)
	percentage=format(round(total/item_number,8),'0.8f')
	result.append(percentage)

for each in result:
	print(each)



T = int(input())
if not  (1 <= T <= 5):
	assert("ERROR")
for t in range(T):
	N = float(input())
	P = []
	s = 0
	P = input().split()
	for x in P:
		s += float(x)
	print(("%0.8f" % float(s/len(P))))


T = int(input())
for i in range(T):
	N = float(input())
	lis = list(map(int, input().split()))
	sm = sum(lis)
	print((format(sm/N, '.8f')))


'''
# Read input from stdin and provide input before running code
'''
test = int(input())
i = 0
while i < test:
	items = int(input())
	percentage = list(map(int, input().split()))

	total = sum(list(percentage))
	
	new_percent = float(total)/items

	print("%.8f" %new_percent)
	
	i += 1




def print_results(P,N):
	S  = sum(P)
	print('%.8f' % (S / (N*1.0)))
	

def test():
	T = int(input())
	counter = 0
	while counter < T:
		N = int(input())
		P = [int(x) for x in input().split(' ')]
		print_results(P,N)
		counter += 1
test()        


# -*- coding: utf-8 -*-
"""
/**********************************************************************************************
* Sometimes it is the people no one imagines anything of who do the things no one can imagine.*
*                                                                                             *
*                                    User: LLcoolNJ                                           *
***********************************************************************************************/
"""
import sys
inp = sys.stdin.readline

def getInt():
	return int(inp().strip())
	
def getList():
	return list(map(int, inp().strip().split()))

def getStr():
	return inp().strip().split()

T = getInt()

for _ in range(T):
	N = getInt()
	P = getList()
	s = 0
	d = float(N)
	for i in range(N):
		s += P[i]/d
	print("%.8f" %(round(s, 8)))


# -*- coding: utf-8 -*-
"""
/**********************************************************************************************
* Sometimes it is the people no one imagines anything of who do the things no one can imagine.*
*                                                                                             *
*                                    User: LLcoolNJ                                           *
***********************************************************************************************/
"""
import sys
inp = sys.stdin.readline

def getInt():
	return int(inp().strip())
	
def getList():
	return list(map(int, inp().strip().split()))

def getStr():
	return inp().strip().split()

T = getInt()

for _ in range(T):
	N = getInt()
	P = getList()
	s = 0
	d = float(N)
	for i in range(N):
		s += P[i]/d
	print("%.8f" %(round(s, 8)))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t = eval(input())
for test in range(t):
	n = eval(input())
	arr = list(map(int, input().split(' ')))
	sum = 0
	for i in range(n):
		sum += arr[i]
	ans = "%.8f" %(sum/float(n))
	print(ans)


T=eval(input())
#print "T=",T
#N=input()
#print "N=",N
#data=raw_input()
#print "data=",data
#chocper=[]
#chocper=data.split(" ")
#print "chocper=",chocper
for j in range(T):
	N=eval(input())
	data=input()
	#print "data=",data
	chocper=[]
	chocper=data.split(" ")
	sum=0.0
	for i in range(N):
		sum=int(chocper[i])+sum
	
	avg=sum/N
	avg=format(avg,".8f")
	print(avg)


test_cases = int(input())
for test_case in range(0, test_cases):
	number_of_choclates = int(input())
	percentage_string = input()
	percentage_array = percentage_string.split(' ', number_of_choclates - 1)
	sum = 0
	for percentage in percentage_array:
		sum += int(percentage)
	average = sum / float(number_of_choclates)
	print('%.8f' % average)


'''
# Read input from stdin and provide input before running code
'''
test = int(input())

for i in range(test):
	items = int(input())
	percentage = list(map(int, input().split()))

	total = sum(list(percentage))
	
	new_percent = float(total)/items

	print("%.8f" %new_percent)
	




x=int(input())
for t in range(x):
	inp_range=int(input())
	val=input()
	val1=val.split()
	sum=0
	for i in range(int(inp_range)):
		sum=sum+int(val1[i])
	output=sum/float(inp_range)
	print("{0:.8f}".format(round(output,8)))




M=int(input())
mlist=[[] for i in range(0,M)]
N=[0 for i in range(0,M)]

for i in range(0,M):
	N[i]=int(input())
	line=input().split(" ")
	for n in line:
		mlist[i].append(int(n))

for i in range(0,M):
	sum=0
	for j in range(0,N[i]):
		sum=sum+mlist[i][j]
	print(("{0:.8f}".format(round(sum/float(N[i]),8))))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
test = eval(input())
for i in range(test):
	lsum = 0
	n = eval(input())
	numbers = list(map(float, input().split()))
	for i in numbers:
		lsum = lsum + i
	print(format(lsum/n,'.8f'))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
def main():
	tc = int(input())
	temp_list = []
	for i in range(tc):
		total_items = int(input())
		c_per_list = [ int(num) for num in input().split()]
		temp_list.append(c_per_list)
	for i in temp_list:
			new_list = i
			total =  round(float(sum(new_list))/len(new_list),8)
			print(format(total,'.8f'))
		

if __name__ == '__main__':
	main()


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import math
for _ in range(eval(input())):
	N=eval(input())
	l=list(map(int,input().split()))
	out=float(sum(l))/len(l)
	print('%.8f'%out)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
import math
for _ in range(eval(input())):
	N=eval(input())
	l=list(map(int,input().split()))
	s=sum(l)
	le=len(l)
	out=float(s)/le
	print('%.8f'%out)


t = int(input())
er = []
s=0
for i in range(t):
	n = float(input())
	k = str(input())
	er = k.split(" ")
	for i in er:
		s = s+float(i)
	ans = s/n
	print("%.8f"%ans)
	ans=0
	s=0


T = int(input())
for x in range(0,T):
	size = int(input())
	array = list(map(int,input().split()))
	print((format(round(float(float(sum(array))/float(size)),8),'.8f')))


import sys
t=int(input())
while(t>0):
	n=int(input())
	a=list(map(int,sys.stdin.readline().split(" ")))
	val=0.0
	for i in range(0,n):
		val+=a[i]
	val=(val/(100.0*n))*100
	print(("%.8f" % val)) 
	t-=1
		



	

	


num_case=input()
#print num_case

for i in range(0,int(num_case)):
	num_item=input()
#       print num_item

	chocolate_per=0.000000000
	p=[0.0 for k in range(0,int(num_item))]
#       print p



	food_per=input()

	array=food_per.split()
	div=0.0
	for j in range(0,int(num_item)):
		p[j]=0.5*float(array[j])
		chocolate_per=chocolate_per + p[j]
		div=div+0.50000000
	#print round(chocolate_per/div,8)
	print(("{0:.8f}".format(chocolate_per/div)))


num_case=input()
#print num_case

for i in range(0,int(num_case)):
	num_item=input()
#       print num_item

	chocolate_per=0.000000000
	p=[0.0 for k in range(0,int(num_item))]
#       print p



	food_per=input()

	array=food_per.split()
	div=0.0
	for j in range(0,int(num_item)):
		p[j]=0.5*float(array[j])
		chocolate_per=chocolate_per + p[j]
		div=div+0.50000000
	#print round(chocolate_per/div,8)
	print(("{0:.8f}".format(chocolate_per/div)))