In [2]:
def qiuhe (n):
    i=0
    total=0
    while i<n:
        i=i+1
        total=total+i
    return(total)
k=int(input('qing shu ru:'))
m=int(input('qing shu ru:'))
j=int(input('qing shu ru:'))
print(qiuhe(k)+qiuhe(m)+qiuhe(j))


qing shu ru:8
qing shu ru:9
qing shu ru:9
126
126

In [4]:
def qiuhe(n):
    i=1
    total=1
    s=1
    while i<n:
        i=i+1
        s=s+2
        d=1/s
        if(i%2==0):
            total=total-d
        else:
            total=total+d
    return(total)
print(4*qiuhe(1000))
print(4*qiuhe(100000))


3.140592653839794
3.1415826535897198
3.140592653839794
3.1415826535897198

In [5]:
def panduan(n):
    if n.endswith('x') or n.endswith('ch') or n.endswith('sh')or n.endswith('0') or n.endswith('s') or n.endswith('o'):
        print(n,'es',sep='')
    elif n.endswith('y'):
        print('bian y wei i jia es')
    elif n.endswith('f') or n.endswith('fe'):
        print('bain f or fe wei v jia es')
    else:
        print(n,'s',sep='')
n=input()
panduan(n)


ertyyu
ertyyues
ertyyues

In [ ]:
def qiuhe(n,m,k):
    i=n
    total=n
    while i<m:
        i=i+k
        total=total+i
    return(total)
s=input()
l=input()
b=input()
print(qiuhe(s,l,b))