m(n) = 1/2 + 2/3 + ... +n/n+1
def sljisuan(): s = 0 n = int(input("请输入需要求和的数:")) for i in range(1,n+1): s += i/(i+1) print("前{0}项和为{1}".format(n,s)) sljisuan()