In [10]:
#练习 1:写函数,求n个随机整数均值的平方根,整数范围在m与k之间。
#math.sqrt(x)
#Return the square root of x.

import random ,math


m = int(input('please enter an integer,end with a tab: '))
k = int(input('please enter an integer,end with a tab: '))

if m>=k:
    temp = m
    m = k
    k = temp

i = 0
a = 0
n = int(input('the number of the integer,end with a tab: '))
while i <= n:
    i+=1
    a = random.randint(m,k) + a

            
r = math.sqrt(a)
print(r)


please enter an integer,end with a tab: 5
please enter an integer,end with a tab: 10
the number of the integer,end with a tab: 2
4.795831523312719