运行如下:
代码依据
代码如下
# -*- coding : htf_8 -*-
def zediac(year):
a = {0:'鼠',1:'牛',2:'虎',3:'兔',4:'龙',5:'蛇',6:'马',7:'羊',8:'猴',9:'鸡',10:'狗',11:'猪'}
return a[(year-1972)%12]
def xinzuo(month,day):
m =['水瓶座','双鱼座','白羊座','金牛座','双子座','巨蟹座','狮子座','处女座','天秤座',\
'天蝎座','射手座','魔蝎座']
d =(20,19,21,20,21,22,23,23,23,24,23,22)
month = month-1;
if day>d[month]:
return m[month]
else :
return m[month-1]
def funhelp():
print('星座属相查询')
print('年使用农历,月和日使用公历')
print('输入格式:1982-02-24')
return (input('输入个人信息:'))
while True:
a = funhelp().split('-')
year = int(a[0])
month = int(a[1])
day = int(a[2])
print('您的生肖是:%s'%zediac(year))
print('您的星座是:%s'%xinzuo(month,day))