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)