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:
    num = int(input())
    if num == 0:
        break
    
    scores = list(map(int, input().split()))
    average = sum(scores) / num
    
    variance = 0
    for i in range(num):
        variance += (scores[i] - average)**2
    variance = variance / num  
    
    standard_d = math.sqrt(variance)
    print(f"{standard_d:.10f}")

Submission status: Accepted

Solution code:
import math

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

    m = 0.0
    for i in range(n):
        m += int(s[i])
    m /= n

    d = 0.0
    for i in range(n):
        d += (int(s[i]) - m) ** 2
    d = math.sqrt(d / n)

    print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from typing import List
import math


def calc_std():
    while True:
        num_students = int(input())
        if num_students == 0:
            break

        score_list: List[int] = list(map(int, input().split()))
        mean_score = sum(score_list) / len(score_list)
        squared_error = 0

        for i in range(len(score_list)):
            squared_error += (score_list[i] - mean_score) ** 2

        mean_squared_error = squared_error / len(score_list)
        std = math.sqrt(mean_squared_error)

        print(f"{std:.5f}")


if __name__ == "__main__":
    calc_std()

Submission status: Accepted

Solution code:
import math

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

        m = sum(sn) / N
        alpha2 = 0

        for si in sn:
            alpha2 += (si - m)**2 / N

        alpha = math.sqrt(alpha2)
        print('{0:.8f}'.format(alpha))
    else:
        break

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    
    if n==0:
        break
    
    slist = [int(s) for s in input().split()]
    
    m = sum(slist)/n
    
    S = 0
    for i in range(n):
        S += (slist[i]-m)**2
    
    a2 = S/n
    a = math.sqrt(a2)
    print(f'{a:.8f}')

Submission status: Accepted

Solution code:
import math
while 1: 
    n=int(input())
    if n==0:
        break
    else:
        l=list(map(int,input().split()))
        ave=sum(l)/n
        bunsi=0
        for j in l:
            bunsi+=(j-ave)**2
        ans=math.sqrt(bunsi/n)
        print(ans)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    a = [float(i) for i in input().split()]
    average = sum(a) / n
    print((sum([(i - average) ** 2 for i in a]) / n) ** 0.5)

Submission status: Accepted

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

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+=pow((s[i]-m),2)
    print(math.sqrt(a/n))

Submission status: Accepted

Solution code:
while True:
    N = int(input())
    if N == 0:
        break
    else:
        points = [float(x) for x in input().split()]
        ave = sum(points)/N
        
        devi = [(x-ave) ** 2 for x in points]
        vari = sum(devi)/N
        a = vari ** (1/2)
        
        print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import statistics
while 1:
  n = int(input())
  if n == 0:
    break
  s = list(map(int, input().split()))
  x = statistics.pstdev(s)
  print('{:.8f}'.format(x))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break
    else:
        ans = 0
        point = list(map(int,input().split(' ')))
        sum_point = sum(point)
        ave = float(sum_point / n)
        for i in point:
            ans += (i-ave)**2
        ans = ans / n
        print(math.sqrt(ans))

Submission status: Accepted

Solution code:
import statistics
while True:
    if int(input()) != 0: 
        arr = list(map(float,input().split()))
        print(statistics.pstdev(arr))
    else:
        break

Submission status: Accepted

Solution code:
from math import sqrt

while True:
    n = int(input())
    if n == 0:
        break
    s = [int(arg) for arg in input().split()]
    m = sum(s) / n
    dispersion = sum([(s[i] - m)**2 for i in range(n)])/n
    print(sqrt(dispersion))

Submission status: Accepted

Solution code:
from statistics import pstdev

while True:
    num = input()
    if num == "0":
        break
    elif num == "1":
        _ = input()
        print("{:.8f}".format(0))
    else:
        print("{:.8f}".format(pstdev(map(int, input().split()))))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break
    else:
        array = list(map(int, input().split()))
        ave = sum(array)/n
        m = 0
        for i in array:
            m += (i-ave)**2
        ans = math.sqrt(m/n)
        print(ans)

Submission status: Accepted

Solution code:
import statistics

S = []

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

for a in S:
    print(statistics.pstdev(a))

Submission status: Accepted

Solution code:
L = []
import math
while True:
    n = int(input())
    if n == 0:
        break
    l = list(map(int,input().split()))
    m = sum(l)/n
    var = 0
    for i in l:
        var += (i-m)*(i-m)
    L.append(math.sqrt(var/n))
for j in L:
    print('{:.5f}'.format(j))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
from sys import stdin
input = stdin.readline

while True:
    n = int(input())
    if n == 0:
        break
    slist = list(map(int, input().split()))
    n = len(slist)
    m = sum(slist) / n
    asquare = 0
    for num in slist:
        asquare += (num - m)**2 / n
    print(math.sqrt(asquare))

Submission status: Accepted

Solution code:
while 1:
    n = int(input())
    if n==0:break
    l = [0]*n
    list = input().split()
    for i in range(n):
        l[i] = int(list[i])
    m = sum(l)/n
    A = 0
    for j in range(n):
        A +=(l[j] - m)**2 / n
    print(A**.5)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    else:
        x = list(map(int, input().split()))
        m = sum(x)/len(x)
        l = []
        for i in x:
            l.append((i - m)**2/len(x))
        print(sum(l)**(1/2))

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
import statistics

while True:
    n = int(input())
    if n == 0:
        break
    s = tuple(map(int, input().split()))
    print(f'{statistics.pstdev(s):.5f}')

Submission status: Accepted

Solution code:
import math
import itertools
import sys

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

    S = list(map(int, input().split()))
    len_S = len(S)

    m = 0
    for i in S:
      m += i
    m /= len_S

    a_2 = 0
    for i in S:
      a_2 += (i - m) ** 2
    a_2 /= len_S
    a_2 = math.sqrt(a_2)

    print(a_2)

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) / len(s)
    
    a = 0
    for i in range(n) :
        a += (s[i] - m) ** 2
    a /= n
    a = math.sqrt(a)
    print(a)

Submission status: Accepted

Solution code:
import math

while True:
	n=int(input())
	if ( n == 0):
		exit(0)
	intarr = list(map(int, input().split()))
	m = sum(intarr)/len(intarr)
	#print(m)
	aa = 0
	for i in intarr:
		aa = aa + (i-m)**2
	a = math.sqrt(aa/n)
	print(a)

Submission status: Accepted

Solution code:
while list:
    N = int(input())
    if not N:
        break
    *A, = map(int, input().split())
    V = sum(A)/N
    print((sum((a - V)**2 for a in A)/N)**0.5)

Submission status: Accepted

Solution code:
from math import sqrt
while True:
    n = int(input())
    if n==0:
        break

    s = list(map(int, input().split()))
    a2=0
    m = sum(s)/n
    for i in range(n):
        a2 += (s[i]-m)**2
    a2 /= n
    a = sqrt(a2)
    print(a)

Submission status: Accepted

Solution code:
import math
while 1:
    n = int(input())
    if n == 0:
        break
    s = list(map(int,input().split()))
    mean = sum(s)/len(s)
    sum_2 = 0
    for t in s:
        sum_2 += (t-mean)**2
    print(math.sqrt(sum_2/len(s)))

Submission status: Accepted

Solution code:
import math

while True:
    N = int(input())
    if N == 0:
        break
    s = list(map(int, input().split()))
    mean_ = sum(s) / N
    std = 0
    for i in range(N):
        std += ((s[i] - mean_) ** 2)
    print(math.sqrt(std / N))

Submission status: Accepted

Solution code:
import math

n = int(input())
sum_sm = 0
d = []

while n != 0:
    s = input().split()
    sn = [int(si) for si in s]
    m = sum(sn) / n
    for sni in sn:
        sum_sm += (sni - m) ** 2
    d.append(math.sqrt(sum_sm/n))

    n = int(input())
    sum_sm = 0

for di in d:
    print(di)

Submission status: Accepted

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

for indexi,i in enumerate(n):
    m = sum(list(s[indexi]))/i
    a = 0
    for s_row in s[indexi]:
        a += (s_row-m)**2
    print((a/i)**0.5)

Submission status: Accepted

Solution code:
import math
sd_anss = []
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(int, input().split()))
    mean = sum(s)/n
    Sum = 0
    for i in range(n):
        Sum += (s[i]-mean)**2
    sd_anss.append(math.sqrt(Sum/n))
for sd in sd_anss:
    print(sd)

Submission status: Accepted

Solution code:
import math
ndev2 = 0

while True:
    n = int(input())
    if n == 0:
        break
    scores = list(map(int, input().split()))
    avg = sum(scores) / len(scores)
    for i in range(n):
        ndev2 += (scores[i] - avg) ** 2

    dev2 = ndev2 / len(scores)
    dev = math.sqrt(dev2)
    print(dev)
    ndev2 = 0

Submission status: Accepted

Solution code:
import math
m = 0
V = 0

while True:
    n = int(input())
    if n == 0:
        break
    else:
        S = list(map(int,input().split()))
        for i in range(n):
            m += S[i]
        m /= n
        for j in range(n):
            V += (S[j] - m ) ** 2
        V /= n
    print(V ** 0.5)
    m = 0
    V = 0

Submission status: Accepted

Solution code:
import math

while True :
    n = int(input())
    
    if n == 0 :
        break
    else :
        S = [int(s) for s in input().split()]
        a2 = 0
        
        m = sum(S) / n
        
        for i in range(n) :
            a2 += (S[i] - m) ** 2
            
        a = math.sqrt(a2 / n)

    print(f"{a:.5f}")

Submission status: Accepted

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

Submission status: Accepted

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

    mean = sum(score) / num_student

    total = 0
    for i in range(len(score)):
        total += (score[i] - mean) ** 2

    print('{:.8f}'.format(math.sqrt(total / num_student)))

Submission status: Accepted

Solution code:

import math
while 1:
    student_num = int(input())
    if student_num == 0:
        break
    student_scores = list(map(int,input().split()))
    avg = sum(student_scores)/ student_num
    
    a = 0
    
    for i in range(student_num):
        a += (student_scores[i] - avg) ** 2
    
    a = a / student_num
    
    print(math.sqrt(a))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break

    l = list(map(int, input().split()))
    m = sum(l) / n
    amount = 0
    for s in l:
        amount += (s - m)**2
    stdev = math.sqrt(amount / n)
    print(stdev)

Submission status: Accepted

Solution code:
import math
B = []
while True:
    n = int(input())
    s = 0
    if n != 0:
        S = list(map(float,input().split()))
        for i in range(n):
            s += S[i] * S[i]
        m_2 = s / n
        mm = (sum(S) / n)**2
        B.append(math.sqrt(m_2 - mm))
    else:
        for i in range(len(B)):
            print(B[i])
        break

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        exit ()
    else:
        S = list(map(int,input().split()))
        m = sum(S)/n
        sigma = 0
        for i in S:
            sigma += (i-m)**2
        print ((sigma/n)**0.5)

Submission status: Accepted

Solution code:

while True:
  n = int(input())
  if n == 0:
    break
  s = list(map(int,input().split()))
  m = sum(s)/n
  ss = list((si - m)**2 for si in s)
  S = sum(ss)/n
  print(S**0.5)

Submission status: Accepted

Solution code:
import math
import statistics

while(1):
    n=int(input())
    if(not n):
        break
    S=list(map(int,input().split(" ")))
    mean=statistics.mean(S)
    #print(mean)
    S=list(map(lambda x: (x-mean)**2, S))
    #print(S)
    print(math.sqrt(sum(S)/n))

Submission status: Accepted

Solution code:
n = int(input())

while n != 0:
    test = [int(x) for x in input().split()]
    
    ave_test = sum(test)/n
    
    total_test = 0
    for i in range(n):
        sum_test = (test[i] - ave_test)**2
        #print(sum_test)
        total_test += sum_test
    sd_test = (total_test/n)**0.5
    print(sd_test)
    n = int(input())

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if not n:
        break
    l = list(map(int, input().split()))
    m = sum(l) / n
    count = 0
    for i in range(n):
        diff = (l[i] - m)
        count += diff ** 2
    ans = math.sqrt(count / n)
    print(ans)

Submission status: Accepted

Solution code:
import statistics
while True:
    order_num = int(input())
    if order_num == 0:
        break
    l = [int(x) for x in input().split()]
    print('{}'.format(statistics.pstdev(l)))

Submission status: Accepted

Solution code:
import statistics


if __name__ == "__main__":
    stdevs = []

    while True:
        num_students = int(input())

        if num_students == 0:
            break

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

        s = statistics.pstdev(scores)

        stdevs.append(s)

    for s in stdevs:
        print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
while True:
    N = int(input())
    if N == 0:
        break
    A = [int(a) for a in input().split()]
    m = sum(A) / N
    print((sum(map(lambda a: (a - m) ** 2, A)) / N) ** 0.5)

Submission status: Accepted

Solution code:
import sys
import math
from statistics import mean
for e in sys.stdin:
    n = int(e)
    if n == 0:
        break
    s = [0]*n
    s = list(map(int,sys.stdin.readline().split()))
    m = mean(s)
    Val = 0
    for i in range(n):
        Val += (s[i]-m)**2/float(n)
    sigma = math.sqrt(Val)
    print(str(sigma))

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if n==0:
        break
    an = list(map(int, input().split()))
    mean = sum(an)/n
    v = sum(list(map(lambda x: (x-mean)**2, an)))/n
    std = math.sqrt(v)
    print(round(std,6))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0: break
    point = [float(x) for x in input().split()]
    sum = 0
    for i in range(n):
        sum += point[i]
    ave = sum / n
    var = 0
    for i in range(n):
        var += (point[i] - ave)**2
    var /= n
    print(math.sqrt(var))

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if n == 0:
        break
    else:
        slst = list(map(int, input().split()))
        mean = sum(slst)/n
        v = sum([(s-mean)**2 for s in slst])/n
        std = math.sqrt(v)
        print(f"{std:.5f}")

Submission status: Accepted

Solution code:
import math

while True:
    N = int(input())
    ans = 0
    if N == 0:
        break

    else:
        data = [int(n) for n in input().split()]
        m = sum(data)/N
        for d in data:
            ans += (d-m)**2

        print(math.sqrt(ans/N))

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
    v = 0
    for si in s:
        v += (si - m) ** 2
    ans = math.sqrt(v/n)      
    print("{:.5f}".format(ans))

Submission status: Accepted

Solution code:
import math
while True:
    N = int(input())
    if N == 0:
        break
    list1 = list(map(int, input().split()))
    avg = sum(list1) / N
    total = 0
    for n in range(N):
        total = total + (list1[n] - avg)**2
    S = math.sqrt(total / N)
    print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
cnt = 1
while True:
    input_ = list(map(int, input().split()))

    if cnt % 2 == 1:
        n = input_
        if n[0] == 0:
            break
    else:
        scores = input_
        m = sum(scores) / len(scores)
        sigma = (sum([(score - m)**2 for score in scores]) / len(scores)) ** (1/2)
        print(sigma)
    cnt += 1

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break
    else:
       points = list(map(int, input().split()))
       mean = sum(points) / len(points)
       std = 0
       for num in points:
           std += (num-mean)**2
       std = math.sqrt(std / len(points))
       print(std)

Submission status: Accepted

Solution code:
import math

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

    m = sum(points) / n
    variance = sum(map(lambda x: (x - m) ** 2, points)) / n
    standard_deviation = math.sqrt(variance)
    print(standard_deviation)

Submission status: Accepted

Solution code:
while True:
    N=int(input())
    if N==0:
        break
    a=list(map(int,input().split()))
    m=0
    s=0
    for i in range(N):
        m+=a[i]
    m=m/N
    for i in range(N):
        s+=(a[i]-m)**2
    s=s/N
    s=s**(1/2)
    print(round(s,6))

Submission status: Accepted

Solution code:
import math

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

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

    avg = sum(scores) / n
    sigma = 0
    for s in scores:
        sigma += (s - avg)**2 / n

    print(math.sqrt(sigma))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import pstdev


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

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
    ans = 0
    for i in range(n):
        ans += (s[i] - m) * (s[i] - m) / n
    print(math.sqrt(ans))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n == 0:
        break
    a = list(map(int, input().split()))
    # mean
    mean = sum(a)/len(a)
    # variance
    for i in range(len(a)):
        a[i] = a[i] - mean
        a[i] = a[i]**2
    vari = sum(a)/len(a)
    s_devi = math.sqrt(vari)
    print(s_devi)

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    scores = [*map(float, input().split())]
    average = sum(scores)/n
    s = (sum([(score - average)**2 for score in scores])/n)**0.5
    print('%f'%s)

Submission status: Accepted

Solution code:
import math

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

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

  std_dev.append(math.sqrt(disp))

for i in range(len(std_dev)):
  print(std_dev[i])

Submission status: Accepted

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

    print(math.sqrt(sum/n))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Problem - 標準偏差

import math

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

    # initialization
    average = sum(s_list) / n
    dispersion = 0
    for i in range(n):
        dispersion += (s_list[i] - average)**2
    dispersion = dispersion / n
    ans = math.sqrt(dispersion)

    # output
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import sqrt
while 1:
    n=int(input())
    if n==0:
        break
    else:
        l=[int(i) for i in input().split()]
        a=sum(l)/n
        l_=[(x-a)**2 for x in l]
        print("{:.5f}".format(sqrt(sum(l_)/n)))

Submission status: Accepted

Solution code:
import math
while True:
    n = int(input())
    if n==0:
        break
    s = [int(x) for x in input().split()]
    mean = sum(s)/len(s)
    tmp = []
    for xi in s:
        tmp.append((xi-mean)**2)
    print(math.sqrt(sum(tmp)/len(tmp)))

Submission status: Accepted

Solution code:
import statistics as st
import math
while True:
    n = int(input())
    if n == 0:
        break

    dat = list(map(int,input().split()))
    ave = st.mean(dat)
    sum = 0
    for i in dat:
        sum += (i-ave)**2
    print(math.sqrt(sum/n))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        break
    s = [int(i) for i in input().split()]
    av = sum(s)/len(s)
    var = sum([(i - av)**2 for i in s])/n
    print(var**0.5)

Submission status: Accepted

Solution code:
import math

def solve(n,s):
    m = sum(s)/n
    ans = 0
    for i in s:
        ans += (i-m)**2
    ans /= n
    print(math.sqrt(ans))

if __name__ == "__main__":
    while 1:
        n = int(input())
        if n == 0:
            break
        s = list(map(int,input().split()))
        solve(n,s)

Submission status: Accepted

Solution code:
import math

aa = 0

while True:
    n = int(input())
    
    if n == 0:
        break
    
    data = list(map(int, input().split()))
    
    m = float(sum(data) / n)
    
    for i in data:
        aa +=  float(((i - m) ** 2) / n)
        
    a = math.sqrt(aa)
    print(a)
    
    aa = 0

Submission status: Accepted

Solution code:
import math
while True:
  n = int(input())
  if n == 0:
    break;
  else:
    sum = 0
    var = 0
    s = input().rstrip().split(' ')
    for i in range(n):
      sum += int(s[i])
    average = sum / n
    for j in range(n):
      var += (int(s[j]) - average) ** 2
    var = math.sqrt(var / n)
    print(var)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from statistics import pstdev

while input() != '0':
    s = list(map(int, input().split()))
    print('{:.8f}'.format(pstdev(s)))

Submission status: Accepted

Solution code:
import statistics

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

for data in dataset:
    print(statistics.pstdev(data))

Submission status: Accepted

Solution code:
while True:
    n = int(input())
    if n == 0:
        exit()
        
    li = list(map(int,input().split()))
    
    m = sum(li)/len(li)
    ans = 0
    
    for i in li:
        ans += ((i-m)**2)
    ans = ans/n
    ans = ans**0.5
    
    print(ans)

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===
def getInputListF():
    outputData = []
    inputData = input().split()
    outputData = [float(n) for n in inputData]

    return outputData

while True:
    n = int(input())
    if n == 0:
        break
    d = getInputListF()
    print(statistics.pstdev(d))

Submission status: Accepted

Solution code:
import math
while True:
    # 入力、終了判定
    n = int(input())
    if n==0:
     break
    a = [int(i) for i in input().split()]

    # 平均mの計算
    total = 0
    for si in a:
        total += si
    m = total/n

    # 分散alpha2の計算
    dif2 = 0
    for si in a:
        dif2 += (si-m)**2
    alpha2 = dif2/n

    # 出力
    print(math.sqrt(alpha2))

Submission status: Accepted

Solution code:
while True:
    student = int(input())
    if student == 0: exit()
    data=[int(item) for item in input().split()]
    tmp=0
    ave = sum(data)/len(data)
    for item in data:
        tmp += (item - ave) ** 2
    #二乗和の平均の平方根が標準偏差
    sigma=(tmp/len(data))**(0.5)
    print(sigma)

Submission status: Accepted

Solution code:

from math import sqrt

while True:
    n = int(input())
    if n==0:break
    s = list(map(int,input().split()))
    m = sum(s)/n
    v = 0.0
    for t in s:v+=(t-m)**2.0
    v = sqrt(v/n)
    print ("%.10f"%(v))

Submission status: Accepted

Solution code:
import math

while True:
    n = int(input())
    if n == 0:
        break
    
    an = [int(x) for x in input().split()]
    ave = sum(an)/n
    var = sum([(a - ave)**2 for a in an])/n
    print(math.sqrt(var))

Submission status: Accepted

Solution code:
n = int(input())
N = []
S = []
M = []
while n != 0:
    N.append(n)
    s = list(map(int, input().split()))
    S.append(s)
    m = sum(s)/n
    M.append(m)
    n = int(input())
for i in range(len(N)):
    x = 0
    for j in range(N[i]):
        x += (S[i][j] - M[i])**2
    print((x/N[i])**0.5)

Submission status: Accepted

Solution code:
s_list = list()
while True:
    n = int(input())
    if n == 0:
        break
    s = list(map(float,input().split()))
    s_list.append(s)

for s in s_list:
    m = sum(s) / len(s)
    dispersion = 0
    for s_num in s:
        dispersion += (s_num - m)**2
    dispersion /= len(s)
    std = dispersion**0.5
    print(std)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    while True:
        N = int(input())
        if N == 0:
            break
        ss = list(map(int, input().split()))
        ave = sum(ss) / N
        ans = 0
        for s in ss:
            ans += (s - ave)**2
        ans = pow(ans/N, 0.5)
        print(ans)


if __name__ == "__main__":
    main()