In [ ]:
#练习3_01#
def constellation(date):
    a1 = int(date[0])
    a2 = int(date[1])
    a3 = int(date[2])
    a4 = int(date[3])
    month = (a1 * 10) + a2
    day = (a3 * 10) + a4
    if month == 1:
        if (day <= 19):
            cons = "摩羯座"
        else:
            cons = "水瓶座"
    elif month == 2:
        if (day <= 18):
            cons = "水瓶座"
        else:
            cons = "双鱼座"
    elif month == 3:
        if (day >= 21):
            cons = "白羊座"
        else:
            cons = "双鱼座"
    elif month == 4:
        if (day <= 19):
            cons = "白羊座"
        else:
            cons = "金牛座"
    elif month == 5:
        if (day <= 20):
            cons = "金牛座"
        else:
            cons = "双子座"
    elif month == 6:
        if (day <=21):
            cons = "双子座"
        else:
            cons = "巨蟹座"
    elif month == 7:
        if (day <=22):
            cons = "巨蟹座"
        else:
            cons = "狮子座"
    elif month ==8:
        if (day <= 22):
            cons = "狮子座"
        else:
            cons = "处女座"
    elif month == 9:
        if (day <= 22):
            cons = "处女座"
        else:
            cons = "天秤座"
    elif month == 10:
        if (day <= 23):
            cons = "天秤座"
        else:
            cons = "天蝎座"
    elif month == 11:
        if (day <= 22):
            cons = "天蝎座"
        else:
            cons = "射手座"
    elif month == 12:
        if (day <= 21):
            cons = "射手座"
        else:
            cons = "摩羯座"
    return cons
name = input('你的名字:')
date = input('你的出生月份日期\n如:0909\n')
print('你是',constellation(date),sep='')


#练习3_02#
def words(voc):
    result = ''
    lenth = len(voc)
    tail = voc[lenth-1]
    lont = voc[lenth-2] + tail
    if (tail == 'p') or (tail == 'g') or (tail == 'r'):
        result = 's'
    elif (tail == 's') or (lont == 'sh') or (lont == 'ch') or (tail == 'x'):
        result = 'es'
    elif (lont == 'ce') or (lont == 'se') or (lont =='ze') or (lont == 'ge'):
        result = 's'
    elif (tail == 'y'):
        result = 'ies'
    return result
voc = input('请输入单词:')
lenth = len(voc)
tail = voc[lenth-1]
if tail == 'y':
    for i in range(len-1):
        print(voc[i],words(voc),end='')
else:
    print(voc,words(voc),sep='')

    

#挑战性练习#
def total(m,n,k):
    t = 0
    result = 0
    i = 0
    if m > n:
        m,n = n,m
    i = m
    while i <= n:
        if t == k+1:
            t = 0
        if t == 0:
            result += i
        t += 1
        i += 1
    return result
n = int(input('输入m的值:'))
m = int(input('输入n的值:'))
k = int(input('输入k的值:'))
print('结果为',total(n,m,k),sep='')