from datetime import date
def CalculateAge(born):
today = date.today()
return today.year - born.year - ((today.month, today.day) < (born.month, born.day))
def Zodiac(month, day):
n = (u'摩羯座',u'水瓶座',u'双鱼座',u'白羊座',u'金牛座',u'双子座',u'巨蟹座',u'狮子座',u'处女座',u'天秤座',u'天蝎座',u'射手座')
d = ((1,20),(2,19),(3,21),(4,20),(5,21),(6,22),(7,23),(8,23),(9,23),(10,24),(11,23),(12,22))
return n[len(list(filter(lambda y : y<=(month,day), d))) % 12]
def AgeFrament(age):
n = (u'青少年', u'青年', u'青中年', u'中年', u'壮年', u'老年')
d = (25, 30, 35, 40, 45)
return n[len(list(filter(lambda x : x <= age, d))) % 6]
网友评论