Problem:


Standard Deviation

  You have final scores of an examination for n students. Calculate standard deviation of the scores s1, s2 ... sn.

The variance &alpha;2 is defined by  

&alpha;2  = (&sum;ni=1(si - m)2)/n

  where m is an average of si.

  The standard deviation of the scores is the square root of their variance.
  

Input

  The input consists of multiple datasets. Each dataset is given in the following format:

n
s1 s2 ... sn

  The input ends with single zero for n.

Output

  For each dataset, print the standard deviation in a line. The output should not contain an absolute error greater than 10-4.

Constraints

n ≤ 1000

0 ≤ si ≤ 100 

Sample Input

5
70 80 100 90 20
3
80 80 80
0

Sample Output

27.85677655
0.00000000



Sample input:
5
70 80 100 90 20
3
80 80 80
0


Sample output:
27.85677655
0.00000000

Submission status: Accepted

Solution code:
import math
while True:
    n=int(input())
    if n==0:
        break
    sum=sqsum=0.0
    l=list(map(float,input().split()))
    for e in l:
        sum+=e
        sqsum+=e**2
    mean=sum/n
    sqmean=sqsum/n
    var=sqmean-mean**2
    std=math.sqrt(var)
    print('{:.8f}'.format(std))

Submission status: Accepted

Solution code:
#coding: utf-8

import math

while True:
    n = int(input())
    if n == 0:
        exit()
    else:
        scores = list(map(int, input().split()))
        avrscr = sum(scores) / n
        sd = 0
        for i in scores:
            sd += (i - avrscr) ** 2
        sd /= n
        sd = math.sqrt(sd)
        print(sd)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int,input().split()))
    
    m = sum(s)/n

    total = 0
    for i in range(n):
        total += (s[i]-m)**2
    ans = (total/n)**0.5
    print(ans)

Submission status: Accepted

Solution code:
import math
while True:
    n=int(input())
    if n == 0 : break
    s=list(map(int,input().split()))
    sumv = 0
    for x in s: sumv += x
    mean = sumv/n
    aa=0
    for x in s: aa+=(x-mean)*(x-mean)
    aa/=n
    a = math.sqrt(aa)
    print(f"{a:.5f}")

Submission status: Accepted

Solution code:
from statistics import pstdev

while 1:
    n = int(input())
    if n == 0:break
    s = list(map(float, input().split()))
    print(pstdev(s))

Submission status: Accepted

Solution code:
import math
while True:
    num = int(input())
    if num == 0:
        break
    
    l = [int(x) for x in input().split()]
    average = sum(l)/len(l)
    div = 0
    for i in l:
        div += (i - average) **2
    
    div = math.sqrt(div/len(l))
    print(div)

Submission status: Accepted

Solution code:
while True:
	n = int(input())
	if n == 0:
		break
	list = [int(s) for s in input().split()]
	m=sum(list)/n
	x = 0
	for i in range(n):
		x +=(list[i]-m)**2
	a = (x/n)**0.5
	print(a)

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n==0:
        break
    x = list(map(int,input().split()))

    average = sum(x)/n

    stdev = 0
    for i in range(n):
        stdev+=(x[i]-average)**2
        
    stdev/=n
    print(math.sqrt(stdev))

Submission status: Accepted

Solution code:
import sys

def test():

	state = 0

	for inputs in sys.stdin:

		if state == 0:
			n = int(inputs)
			if n == 0:
				break
			state = 1
		else:
			score_array = list(map(int,inputs.split()))

			m = 0.0
			for score in score_array:
				m += score
			m = m / n

			sigma = 0.0
	
			for score in score_array:
				sigma += (score-m)**2/n
			sigma = sigma**0.5
			print(sigma)
			
			state = 0


if __name__ == "__main__":
	test()

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    samples = list(map(float,input().split()))
    
    m = 0
    for sample in samples:
        m += sample
    m = m / len(samples)
    
    a2 = 0
    for sample in samples:
        a2 += (sample - m) ** 2 / len(samples)
        
    print(a2 ** 0.5)

Submission status: Accepted

Solution code:
import math as math

while 1:
    n = int(input())
    if n == 0:
        break

    s = list(map(float, input().split()))

    su = sum(s)
    m = su / n

    a = 0

    for i in range(n):
        a += ((s[i] - m) ** 2) / n

    print(math.sqrt(a))

Submission status: Accepted

Solution code:

while True:
    n = int(input())
    if n == 0:
        break
 
    s = list(map(int, input().split()))
    m = sum(s) / n
    v = 0
    for si in s:
        v += (si - m) ** 2
    ans = (v / n) ** 0.5
    print("{:.5f}".format(ans))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n==0: break
    s = list(map(int,input().split()))
    m = sum(s)/float(n)
    print("{0:.8f}".format(math.sqrt(sum([(x-m)**2 for x in s])/n)))

Submission status: Accepted

Solution code:
while input()!='0':
  s=list(map(int,input().split()))
  n=len(s)
  m=sum(s)/n
  a=((sum((x-m)**2 for x in s)/n)**0.5)
  print(a)

Submission status: Accepted

Solution code:
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))
 
    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    B = tmp_sum/len(table) #平均
 
    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    A = squared_sum/len(table)
 
    print("%.10f"%(math.sqrt(A-B*B)))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
 
    if n == 0:
        break
 
    a = list(map(int, input().split()))
    m = sum(a) / n
    func = (lambda x: (x - m) ** 2)
    print((sum(map(func, a)) / n) ** .5)

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        exit()
    s = list(map(int, input().split()))
    ave = float(sum(s) / n)
    r = 0
    for j in range(n):
        r += float(pow(s[j] - ave, 2))
    print(math.sqrt(r / n))

Submission status: Accepted

Solution code:
import math
while True:
  if input() == '0':
    break
  a=list(map(int,input().split()))
  m=sum(a)/len(a)
  b=0
  for i in a:
    b += (i-m)**2.0
  stddev = math.sqrt(b/len(a))
  print(stddev)

Submission status: Accepted

Solution code:
import math

def calculate_variance(data):
  s_avg = sum(data) / len(data)
  sum_tmp=0
  for i in range(len(data)):
    sum_tmp += (s_avg-data[i])**2
  return math.sqrt(sum_tmp/len(data))

while True:
  input_sn=int(input())
  if input_sn == 0:
    break
  else:
    students = list(map(int,input().split()))
    s_variance = calculate_variance(students)
    print(s_variance)

Submission status: Accepted

Solution code:
while True:
	N = int(input())
	if N == 0:
		break
	S = list(map(float, input().split()))

	avg = sum(S) / N
	bunsan = 0
	for s in S:
		bunsan += (s - avg)** 2
	bunsan /= N
	print(bunsan ** 0.5)

Submission status: Accepted

Solution code:
import math
N = 0
arr = []
while True:
    N = int(input())
    if N==0:
        break
    arr = list(map(float,input().split()))
    m = 0
    for i in range(len(arr)):
        m += arr[i]
    m /= N
    
    a2 = 0
    for i in range(len(arr)):
        a2 += (arr[i]-m)**2
    a2 = a2/N
    a = math.sqrt(a2)
    print("%.4f"%a)

Submission status: Accepted

Solution code:
def calc_variance(size, nums):
    average = sum(nums) / size
    variance = sum([(x - average) ** 2 for x in nums]) / size
    return variance

while True:
    n = int(input())
    if n == 0:
        break
    scores = list(map(int, input().split()))
    standard_deviation = calc_variance(n, scores) ** 0.5
    print(standard_deviation)

Submission status: Accepted

Solution code:
import math
while(True):
  n = int(input())
  if n == 0:
    break;
  s = list(map(int, input().split()))
  ave = sum(s)/n
  dif = 0
  for i in range(n):
    dif = dif + (ave - s[i])*(ave - s[i])
  sd = math.sqrt(dif/n)
  print(round(sd, 8))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:break
    s = list(map(int, input().split()))
    m = sum(s) / n
    print("{0:.5f}".format(math.sqrt(sum([(x-m)**2 for x in s])/n)))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    
    s = list(map(int,input().split()))
    m = sum(s) / n
    t = 0
    for si in s:
        t += (si - m) ** 2
    a = (t /n) **0.5
    print("{:.5f}".format(a))

Submission status: Accepted

Solution code:
while int(input()):
 s=list(map(int,input().split()))
 n=len(s)
 a=sum(s)/n
 print((sum(x*x for x in s)/n-a*a)**.5)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    scores = list(map(int, input().split()))

    mean = sum(scores) / n

    print((sum([(score-mean) ** 2 for score in scores]) / n) ** 0.5)

Submission status: Accepted

Solution code:
while True:
	import math
	n=int(input())
	if n==0:
		break
	st=list(map(int,input().split()))
	hei=sum(st)/n
	hensa=[]
	for a in range(n):
		hensa.append(((st[a]-hei)**2)/n)
	print(math.sqrt(sum(hensa)))

Submission status: Accepted

Solution code:
while input()!='0':
    n=list(map(int,input().split()))
    b=len(n)
    a=sum(n)/b
    print((sum((x-a)**2 for x in n)/b)**0.5)
    if n == 0:
      break

Submission status: Accepted

Solution code:

from enum import Enum
import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001


while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))

    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    B = tmp_sum/len(table) #平均

    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    A = squared_sum/len(table)

    print("%.10f"%(math.sqrt(A-B*B)))

Submission status: Accepted

Solution code:
import math

while True:
  n = int(input())
  if n == 0:
    break
  s = list(map(int,input().split()))
  
  a2 = 0
  avg = sum(s) / len(s)
  for i in s:
    a2 += (i-avg)**2
  a = math.sqrt(a2/n)
  
  print(a)

Submission status: Accepted

Solution code:
while int(input()):
  s = list(map(int, input().split()))
  n = len(s)
  a = sum(s)/n
  print((sum(x * x for x in s)/n - a * a) ** 0.5)

Submission status: Accepted

Solution code:
import math as mp
ans = []
while True:
    n = int(input())
    if n==0:
        break
    s = list(map(int,input().split()))
    m = sum(s)/len(s)
    ans.append( mp.sqrt(sum([(ele-m)**2 for ele in s])/len(s)) )
for ele in ans:
    print(ele)

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())  # 生徒の数
    if n == 0:
        break
    s = list(map(int, input().split()))  # 生徒の点数リスト

    # 平均値を求める
    sum = 0
    for i in s:
        sum += i
    m = sum / n

    # 分散を求める
    a = 0
    for i in s:
        a += (i - m) ** 2
    a /= n

    print(math.sqrt(a))

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if 0 == n:
        break

    ss  = list(map(int, input().split()))
    ave = sum(ss[:]) / n

    sig = 0
    for s in ss:
        sig += (s - ave)**2
    sig = math.sqrt(sig/n)

    print(sig)

Submission status: Accepted

Solution code:
import math
 
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
 
    m = sum(s) / n
    a = 0
    for i in range(n):
        a += (s[i] - m) ** 2
    a = math.sqrt(a / n)
    print("{:5f}".format(a))

Submission status: Accepted

Solution code:
kai = []
while True :
  n = int(input())
  if n == 0 :
    break
  s = list(map(int,input().split()))

  m = sum(s)/(len(s))
  
  
  a = [(i-m ) for i in s]
 
  a0 = [r**2 for r in a]
  
  a1 = sum(a0)
  
  a2 = (a1/(len(s)))**(1/2)
  kai.append(a2)
  
  
for k in kai :
  print(k)

Submission status: Accepted

Solution code:
i=0
sigma=[]
while True:
    N=int(input())
    goukei=0
    if N==0:
        break
    else:
        sample=list(map(int,input().split()))
        for j in range(len(sample)):
            heikin=sum(sample)/len(sample)
            goukei+=(sample[j]-heikin)**2
        sigma.append((goukei/len(sample))**0.5)
        i+=1
for k in range(i):
    print(sigma[k])

Submission status: Accepted

Solution code:
while (True):
    n = int(input())
    if (n != 0):
        stu = list(map(int, input().split()))
        s = sum(stu) / n
        var = 0
        for i in range(n):
            var += (stu[i] - s) ** 2
        print((var / n) ** 0.5)
    else:
        break

Submission status: Accepted

Solution code:
import math


if __name__ == "__main__":
    while True:
        dataset_num = int(input())
        if dataset_num == 0:
            break
        dataset = list(map(lambda x: float(x), input().split()))
        mean = sum(dataset) / dataset_num
        variance = sum(map(lambda x: (x - mean) ** 2, dataset)) / dataset_num
        print(f"{math.sqrt(variance)}")

Submission status: Accepted

Solution code:
while True:
    n = int(raw_input())
    if n==0: break
    l = map(float, raw_input().split())
    avg=sum(l)/len(l)
    naka=0
    for i in l:
        naka+=(i-avg)**2
    hyo2 = naka/n
    print (hyo2)**0.5

Submission status: Accepted

Solution code:
while input()!='0':
    n=list(map(int,input().split()))
    b=len(n)
    a=sum(n)/b
    c=(sum((x-a)**2 for x in n)/b)**0.5
     
    print(c)

Submission status: Accepted

Solution code:
while input()!='0':
    n=list(map(int,input().split()))
    b=len(n)
    a=sum(n)/b
    c=(sum((x-a)**2 for x in n)/b)**0.5
    
    print(c)

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
        except EOFError:
            break
    return N

def main():

    while True:
        N = int(input())
        if N == 0:
            break
        data = [int(x) for x in input().split()]

        m = sum(data) / N
    
        t = 0
        for i in data:
            t += (i-m)**2

        print(math.sqrt(t/N))



if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))

    m = sum(s) / n
    a = 0
    for i in range(n):
        a += (s[i] - m) ** 2
    a = math.sqrt(a / n)
    print("{:5f}".format(a))

Submission status: Accepted

Solution code:
# coding: utf-8

while True:
    n = int(input())
    if n == 0:
        break

    s = list(map(float, input().split()))
    m = sum(s) / n

    a_2 = sum([(x - m) ** 2 for x in s]) / n
    print(a_2 ** 0.5)

Submission status: Accepted

Solution code:
while True:
    n=int(input())
    if n==0:
        break
    a=list(map(int,input().split()))
    mean=sum(a)/n
    std=0
    for i in range(n):
        std+=(a[i]-mean)**2
    std/=n
    print(std**0.5)

Submission status: Accepted

Solution code:
import math


while True:
	n= int(input())
	if n==0:
		break
	data=list(map(float,input().split()))
	ave=sum(data)/n
	data2=list(map(lambda x:(x-ave)**2, data))
	print((sum(data2)/n)**0.5)

Submission status: Accepted

Solution code:
a = []
while True:
    n = int(input())
    if n == 0:
        break
    else:
        goukei = 0
        v = 0
        s = list(map(int, input().split()))
        for i in range(len(s)):
            goukei = goukei + s[i] #合計
        ave = goukei / n           #平均
        for i in range(len(s)):
            v = v + pow(s[i]-ave,2)/n  #分散
        a.append(pow(v,1/2))  #標準偏差

for i in a:
    print(i)

Submission status: Accepted

Solution code:
import math
 
while True:
  n = int(input())
  if n == 0:
    exit()
  else:
    x = list(map(int, input().split()))
    m = sum(x) / n
    S = 0
    for i in range(n):
      S += (x[i] - m) ** 2
    S /= n
  print(math.sqrt(S))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if not n:
        break
    ss = list(map(int, input().split()))
    m = sum(ss) / n
    a2 = sum([(s - m) ** 2 / n for s in ss])
    print(a2 ** 0.5)

Submission status: Accepted

Solution code:
import statistics
while True:
    n = input()
    if n=='0':
        break
    l = map(float, input().split())
    print(statistics.pstdev(l))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    d = 0
    if n == 0:
        break
    else:
        li = list(map(int,input().split()))
        ave = sum(li)/len(li)
        for i in range(len(li)):
            a = li[i] - ave
            d += a**2
        stv = math.sqrt((d)/len(li))
        print(stv)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    data = list(map(int,input().split()))
    average = sum(data) / len(data)
    s = 0
    for i in data:
        s += (i - average) ** 2
    bunsan = s / len(data)
    print(bunsan ** 0.5)

Submission status: Accepted

Solution code:
import math
while True:
    n=int(input())
    if n==0:
        break
    else:
        S=input().split( )
        
        sum=0
        for i in range(n):
            sum = sum+int(S[i])
        ave= sum/n
        val_sum=0
        for i in range(n):
            val_sum = val_sum+(int(S[i])-ave)**2
        val = val_sum/n
        devi= math.sqrt(val)
        print(devi)

Submission status: Accepted

Solution code:
while input() !='0':
  n = list(map(int, input().split()))
  b = len(n)
  a = sum(n)/b
  print( (sum((x-a)**2 for x in n)/b)**0.5)

Submission status: Accepted

Solution code:
import math

while True:
  n=int(input())
  if n==0:
    break
  d=list(map(float,input().split()))

  m=sum(d)
  bar=m/n
  k=0
  for i in d:
    k+=(i-bar)**2/n
    sig=math.sqrt(k)
  print('{:.8f}'.format(sig))

Submission status: Accepted

Solution code:
import statistics


while True:
    
    n = int(input())

    if n == 0:
        break

    list_s = list(map(int, input().split()))

    print(statistics.pstdev(list_s))

Submission status: Accepted

Solution code:
from math import sqrt

def calc_stdev(l):
    res = 0
    mean = sum(l) / len(l)
    for i in l:
        res += (i - mean) ** 2
    
    return sqrt(res / n)

while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))

    print(calc_stdev(s))

Submission status: Accepted

Solution code:
from math import sqrt
while True:
    n = int(input())
    if not n:
        break
    scores = list(map(int, input().split()))
    avg = sum(scores) / n
    print(sqrt(sum((scores[i] - avg) ** 2 for i in range(n)) / n))

Submission status: Accepted

Solution code:
import math
while True:
    N = int(input())
    if(N == 0): break
    lst = list(map(int, input().split()))
    av  = sum(lst) / N
    ti = 0
    for i in lst:
        ti += ((i - av)**2)/N
    d = math.sqrt(ti)
    print(d)

Submission status: Accepted

Solution code:
# ITP_10_C
import math
while True:
    n = int(input())
    if n == 0:
        break
    l = list(map(int, input().split()))
    s = 0
    M = sum(l) / len(l)
    for data in l:
        s += ((data - M)** 2)
    print((s / len(l)) ** 0.5)

Submission status: Accepted

Solution code:
import math
while True:
    st_num = int(input())
    if st_num == 0:
        break
    st_score = [0]*st_num
    st_score = list(map(int,input().split()))
    st_mean=0
    for i in range(st_num):
        st_mean += st_score[i]
    st_mean /= st_num
    st_variance = 0
    for i in range(st_num):
        st_variance += (st_score[i]-st_mean)**2
    st_variance /= st_num
    standard_devi = math.sqrt(st_variance)
    print("%f"%(standard_devi))

Submission status: Accepted

Solution code:
import math
def stddd(alist) :

    adv = sum(alist) / len(alist)
    std = 0.0
    for dd in alist:
        std = std + (dd - adv)**2.0

    std = std/len(alist)
    return math.sqrt(std)


dlist = []
while True:
    n_data = int(input())
    if n_data == 0:
        [print(dd) for dd in dlist]
        break
    dataarr =  map (float, input().split())
    alist = []
    [alist.append(dd) for dd in dataarr]
    dlist.append(stddd(alist))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# ITP1_10_C
import statistics

while 1:
    n = int(input())
    if n == 0 :
        break
    data = map(int, input().split())
    """
    statistics.m = mean(data)
    statistics.median = median(data)
    statistics.variance = variance(data)
    """
    std = float(statistics.pstdev(data))
    
    print(std)

Submission status: Accepted

Solution code:
import statistics
while True:
    num = int(input())
    if num == 0:
        break
    else:
        students = list(map(int,input().split()))
        result = statistics.pstdev(students)
        print(result)

Submission status: Accepted

Solution code:
n = int(input())
while n != 0:
    from math import sqrt
    s = [int(c) for c in input().split()]
    ave = sum(s) / len(s)
    stddev = sqrt(sum([(p - ave)**2 for p in s]) / len(s))
    print(stddev)
    n = int(input())

Submission status: Accepted

Solution code:
import math
while True:
    num = int(input())
    if num == 0:
        break
    line = list(map(int, input().split()))
    average = sum(line)/num
    a = 0
    for i in line:
        a = a + (i - average)**2
    print(math.sqrt(a/num))

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	n = int(input())
	while n != 0:
		s = [int(s) for s in input().split()]
		m = 0
		for i in s:
			m += i
		m = m/n
		tmp = 0 
		for i in s:
			tmp += (i - m)**2
		print("%.10f" % ((tmp/n)**0.5))
		n = int(input())

Submission status: Accepted

Solution code:
import math
result = []

while True:
  n = int(input())
  
  if n == 0:
    break
  
  s = list(int(x) for x in input().split())
  a2 = 0
  m = sum(s) / len(s)
  for x in s:
    a2 += (x - m) ** 2 / n
  result.append(math.sqrt(a2))

for x in result:
  print(x)

Submission status: Accepted

Solution code:
def calculate_mean(data):
        s = sum(data)
        n = len(data)
        mean = s/n
        return mean

def find_difference(data):
    mean = calculate_mean(data)
    diff = []

    for num in data:
        diff.append(num - mean)
    return diff

def calculate_variance(data):
    diff = find_difference(data)
    #差の２乗を求める
    squared_diff = []
    for d in diff:
        squared_diff.append(d ** 2)

    #分散を求める
    sum_squared_diff = sum(squared_diff)
    variance = sum_squared_diff / len(data)
    return variance
    
while True:
    num = int(input())
    if num == 0:
        break
    
    if __name__ == '__main__':
        data = [int(i) for i in input().split()]
        variance = calculate_variance(data)
        std = variance**0.5
        print(std)

Submission status: Accepted

Solution code:
while True:
    n = int(input())

    if(n == 0): break
    
    s = [int(x) for x in input().split(" ")]
    
    m = sum(s)/n
    
    d = 0
    for i in range(n):
        d +=(s[i] - m)**2

    S = d/n
    a = S**0.5
    
    print("{:.9}".format(a))

Submission status: Accepted

Solution code:
import math

while 1:
    lis = []
    st = []
    num = int(input())
    if num == 0:
        break
    else:
        lis = list(map(int, input().split()))
        m = sum(lis) / len(lis)
        for v in lis:
            st.append((v - m)**2)
        print(math.sqrt(sum(st)/num))

Submission status: Accepted

Solution code:
import math
while True:
  n = int(input())
  if n == 0:
    break
  lst = list(map(int, input().split()))
  sum = 0
  for i in range(n):
    sum += lst[i]
  m = sum/n
  sum = 0
  for i in range(n):
    sum += (lst[i] - m)**2
  var = sum/n
  print(math.sqrt(var))

Submission status: Accepted

Solution code:

def calculate_mean(num,data):

	mean = sum(data) / num
	#print('{:.5f}'.format(mean))

	return mean

def find_difference(num,data):

	#平均を求める
	mean = calculate_mean(num,data)
	diff = []
	for num1 in data:
		diff.append(num1-mean)
	return diff

def calculate_variance(num,data):
	#平均との差を求める
	diff = find_difference(num,data)

	#差の二乗を求める
	squared_diff = []

	for d in diff:
		squared_diff.append(d**2)

	#分散を求める
	sum_squared_diff = sum(squared_diff)
	variance = sum_squared_diff/num

	return variance

if __name__ == '__main__':

	while True:
		num = int(input())

		if num == 0:
			break
		data_s = input().split(" ")
		data = [int(i) for i in data_s]

		#分散を求める
		variance = calculate_variance(num,data)

		#標準偏差
		std = variance**0.5
		print('{:.5f}'.format(std))

Submission status: Accepted

Solution code:
import statistics

while int(input()):
    data = list(map(float, input().split()))
    print(statistics.pstdev(data))

Submission status: Accepted

Solution code:
while True:
	n = int(input())
	if n == 0: break
	l = list(map(int, input().split()))
	m = sum(l) / n
	print(f'{(sum((s-m)**2 for s in l) / n) ** 0.5:.5f}')

Submission status: Accepted

Solution code:
from statistics import *
while int(input()):
    print(pstdev(map(int,input().split())))

Submission status: Accepted

Solution code:
while True:
    x =int(input())

    if x == 0:
        break

    y = input()
    list = y.split()
    list_i = [int(s) for s in list]

    list2 = []
    ave = sum(list_i) / len(list_i)

    for a in range(0, x):
        b = list_i[a] - ave
        b2 = b ** 2
        list2.append(b2)

    ave2 = sum(list2) / len(list2)
    ans = ave2 ** 0.5
    print(ans)

Submission status: Accepted

Solution code:
import math

while True:
  n = int(input())

  if n == 0: break

  data = input().split()

  average = 0.0

  for i in data:
    average += int(i)

  average /= n 

  s_th_power = 0.0

  for i in data:
    s_th_power += (int(i)-average) * (int(i)-average)

  s_th_power /= n

  s = 0.0

  s = math.sqrt(s_th_power)

  print("%.8f"%s)

Submission status: Accepted

Solution code:
import math
n = int(input())
while n:
    nums = list(map(float, input().split()))
    m = sum(nums) / n
    a2 = 0.0
    for i in nums:
        a2 += (i - m)**2
    a = math.sqrt(a2/n)
    print(a)
    n = int(input())

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    
    s = input().strip().split()
    s = [float(i) for i in s]
    Sum = sum(s)
    m = Sum/n
    aa = 0
    
    for i in range(n):
        aa += (s[i]-m)**2
    arfa = (aa/n)**0.5
    
    print(arfa)

Submission status: Accepted

Solution code:
import math
while True:
    sv = 0
    N = int(input())
    if N == 0:
        break
    data = list(map(int, input().split()))

    av = sum(data)/N

    for i in range(N):
        sv += (data[i]-av)**2

    print('{0:6f}'.format(math.sqrt(sv/N)))

Submission status: Accepted

Solution code:
import math

while True:
    N = int(input())
    if N == 0:
        break
    table = list(map(int,input().split()))
 
    tmp_sum = 0
    for i in range(len(table)):
        tmp_sum += table[i]
    b = tmp_sum/len(table)
 
    squared_sum = 0
    for i in range(len(table)):
        squared_sum += table[i]*table[i]
    a = squared_sum/len(table)
 
    print("%.10f"%(math.sqrt(a-b*b)))

Submission status: Accepted

Solution code:
import math

s = []
c = 0

while True:
    ss = 0
    n = int(input())
    if n == 0:
        break
    else:
        score = list(map(int, input().split()))
        ave = sum(score) / n

        for i in range(n):
            ss += (score[i] - ave) ** 2

        s.append(math.sqrt(ss / n))
    c += 1

for i in range(c):
    print(s[i])

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input()) #学生の人数
    if n == 0:
        break
    scores = list(map(int,input().split()))

    sum = 0
    for score in scores:
        sum += score

    m = sum / n #平均点

    s1 = 0
    for score in scores:
        s1 += (score - m)**2

    dispersion = s1 / n #分散
    deviation = math.sqrt(dispersion)

    print(deviation)

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break
    else:
        datas = list(map(int, input().split()))
        total = sum(datas)
        avg = total / n
        total2 = 0
        for data in datas:
            total2 += (data - avg) ** 2
        print(math.sqrt(total2 / n))

Submission status: Accepted

Solution code:
import math

while True:
    N = int(input())
    if N==0:
        break
    
    lst = [int(x) for x in input().split()]

    avr = sum(lst)/N

    cal = 0
    for x in lst:
        cal += (x-avr)**2
    print(math.sqrt(cal/N))

Submission status: Accepted

Solution code:
import math
while True:
    N=int(input())
    if N==0:
        break
    data=list(map(int,input().split()))
    m=sum(data)/N
    goukei=0
    for i in data:
        goukei+=(i-m)**2
    a=math.sqrt(goukei/N)
    print(a)

Submission status: Accepted

Solution code:
while int(input()) != 0:
    a = [int(i) for i in input().split()]
    a = list(map(lambda x: (x-(sum(a)/len(a)))**2, a))
    print((sum(a)/len(a))**.5)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    
    score = list(map(int, input().split()))
    m = sum(score) / len(score)
    
    ls = [  (score[i] - m)**2 / n for i in range(n)]
    aa = sum(ls)
    print(pow(aa, 1/2))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    p = list(map(int,input().split()))
    s = 0
    for i in range(n):
        s += (p[i]-sum(p)/len(p))**2
    print((s/n)**(1/2))
    p.clear()

Submission status: Accepted

Solution code:
import math
while 1:
    num = int(input())
    if num == 0:
        break
    a = [int(_) for _ in input().split()]
    ave = 0
    dev = 0
    for i in range(num):
        ave += a[i]
    else:
        ave /= num
    for i in range(num):
        dev +=math.pow(a[i]-ave,2)
    else:
        dev = math.sqrt(dev/num)
    print(dev)

Submission status: Accepted

Solution code:
while True:
  n = int(input())
  if n == 0:
    break
  pts = list(map(int, input().split()))
  s = 0
  m = sum(pts) / len(pts)
  for pt in pts:
    s += (pt - m) ** 2
  print((s / len(pts)) ** 0.5)