输入年份计算生肖年份

 

 

#-*-coding:utf-8 -*-

tiangan = {4: "", 5: "", 6:"",7:"",8:"",9:"",0:"",1:"",2:"",3:""}
dizhi = {4: "", 5: "", 6:"",7:"",8:"",9:"",10:"",11:"",0:"",1:"",2:"",3:""}
shengxiao = {4: "", 5: "", 6:"",7:"",8:"",9:"",10:"",11:"",0:"",1:"",2:"",3:""}

##for key in tiangan:
##    print(str(key)+":"+tiangan[key])

##for key in dizhi:
##    print(str(key)+":"+dizhi[key])
if __name__ == '__main__':
    year = 1980
    ##计算10天干获取年份的最后一位
    tg_key = str(year)[-1]
    tg=tiangan[int(tg_key)]
    ##计算12地支
    dz_key = year % 12
    dz = dizhi[dz_key]
    sx= shengxiao[dz_key]
    print(tg)
    print(dz)
    print(sx)

 

posted @ 2021-10-22 11:09  slnngk  阅读(88)  评论(0编辑  收藏  举报