In [2]:
def _sum(end): 
    i=0 
    total=1
    while i<end:
        i=i+1
        total=total*i

    return total
m=int(input('请输入一个整数,以回车结束')) 
n=int(input('请输入一个整数,以回车结束')) 
k=int(input('请输入一个整数,以回车结束'))
print('最终和是:',_sum(m)+_sum(n)+_sum(k))


Pleasse input an integer,and end with Enter.9
45

In [4]:
def end(a):
    i=1
    total=0
    j=0
    
    while i<a:
        if(j%2==0):
            total=total-1/i
        else:
            total=total+1/i
        i=i+2
        j=j+1
        
    return total

b=int(input('请输入一个整数,以回车结束'))
print(end(b)*4)


请输入一个整数,以回车结束100000
-3.1415726535897814

In [1]:
def XZ(month,day):
    if month==3:
        if day<=31 and day>=21:
            return('白羊座')
    if month==4:
        if day>=1 and day<=19:
            return('白羊座')
    if month==4:
        if day<=30 and day>=20:
            return('金牛座')
    if month==5:
        if day>=1 and day<=20:
            return('金牛座')
    if month==5:
        if day<=31 and day>=21:
            return('双子座')
    if month==6:
        if day>=1 and day<=21:
            return('双子座')
    if month==6:
        if day<=30 and day>=22:
            return('巨蟹座')
    if month==7:
        if day>=1 and day<=22:
            return('巨蟹座')
    if month==7:
        if day<=31 and day>=23:
            return('狮子座')
    if month==8:
        if day>=1 and day<=22:
            return('狮子座')
    if month==8:
        if day<=31 and day>=23:
            return('处女座')
    if month==9:
        if day>=1 and day<=22:
            return('处女座')
    if month==9:
        if day<=30 and day>=23:
            return('天秤座')
    if month==10:
        if day>=1 and day<=23:
            return('天秤座')
    if month==10:
        if day<=31 and day>=24:
            return('天蝎座')
    if month==11:
        if day>=1 and day<=22:
            return('天蝎座')
    if month==11:
        if day<=30 and day>=23:
            return('射手座')
    if month==12:
        if day>=1 and day<=21:
            return('射手座')
    if month==12:
        if day<=31 and day>=22:
            return('摩羯座')
    if month==1:
        if day>=1 and day<=19:
            return('摩羯座')
    if month==1:
        if day<=31 and day>=20:
            return('水瓶座')
    if month==2:
        if day>=1 and day<=18:
            return('水瓶座')
    if month==2:
        if day<=28 and day>=19:
            return('双鱼座')
    if month==3:
        if day>=1 and day<=20:
            return('双鱼座')

print('Please input your name.')
name=input()
print('Please input your birthday.')
a=int(input())
b=int(input())
print(XZ(a,b))
if a==7:
    if b<=31 and b>=23:
        print('你是很有个性的狮子座')
if a==8:
    if b>=1 and b<=22:
        print('你是很有个性的狮子座')


Please input your name.
Halo
Please input your birthday.
7
28
狮子座
你是很有个性的狮子座

In [2]:
def fushu(word):
    if word.endswith('o'):
        return word+'es'
    elif word.endswith('s'):
        return word+'es'
    elif word.endswith('h') and word[-1:].endswith('c'):
        return word+'es'
    elif word.endswith('h') and word[-1:].endswith('s'):
        return word+'es'
    elif word.endswith('y'):
        word=word[0:-1]
        return word+'ies'
    else:
        return word+'s'
    
print('请输入一个动词单数')
a=input()
print(fushu(a))


请输入一个动词单数
apply
applies

In [6]:
def he(a,b,c):
    i=0
    total=0
    i=a
    
    while i<=b:
        total=total+i
        i=i+c
    return total
        
m=int(input('请输入一个整数'))
n=int(input('请输入一个整数'))
k=int(input('请输入一个整数'))
print(he(m,n,k))


请输入一个整数1
请输入一个整数9
请输入一个整数1
45

In [ ]: