静电场测绘实验数据计算器(python)

import math


def average(list):
    ave = sum(list) / 8
    print(list, '\n平均值=%.4f' % ave)
    lnr1 = math.log(ave)
    print(' lnr =%.5f' % lnr1)


a = float(input('请输入2a的值\n')) / 20
b = float(input('请输入2b的值\n')) / 20

logb = math.log(b)
logba = math.log(b / a)

for i in [0.2, 0.3, 0.4, 0.5, 0.6]:
    print('{}的lnr理论 = %.3f'.format(i) % (logb - i * logba))

x = 1
while x < 5:
    l = [float(input('请输入r{}\n'.format(m))) for m in range(1, 9)]
    average(l)
    x += 1

你可能感兴趣的:(笔记,python,算法)