1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
| list1=['子','丑','丑','寅','寅','卯','卯','辰','辰','巳','巳','午','午','未','未','申','申','酉','酉','戌','戌','亥','亥','子'] list2=['大安','留连','速喜','赤口','小吉','空亡'] list3=['木','土','火','金','水','土'] list4=['东','四方','南','西','北','中央'] list5=['青龙','腾蛇','朱雀','白虎','玄武','勾陈'] list6=['沐浴','冠带','临官','帝旺','衰','死','病','墓','绝','胎','养','长生'] list7=['胎','养','长生','沐浴','冠带','临官','帝旺','衰','死','病','墓','绝'] list8=['死','病','墓','绝','胎','养','长生','沐浴','冠带','临官','帝旺','衰'] list9=['帝旺','衰','死','病','墓','绝','胎','养','长生','沐浴','冠带','临官'] list10=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] list11=['青龙','朱雀','勾陈','白虎','玄武','腾蛇'] dict1={'子': 1,'丑': 2,'寅': 3,'卯': 4,'辰': 5,'巳': 6,'午': 7,'未': 8,'申': 9,'酉': 10,'戌': 11,'亥': 12} dict2={'木':6,'火':7,'金':8,'水':9,'土':9} while True: try: time=int(input("以24时制输入当地当前时:")) except (ValueError, TypeError): print("错误,输入数字有误,例:当前13:11,则输入13") continue if time in list10: break else: print("错误,输入数字有误,例:当前13:11,则输入13") print("输入心中立即想到的任意大小的正整数") numbers1 = [None, None, None] for i in range(3): while True: try: numbers1[i] = int(input(f"请输入第 {i + 1} 个数字: ")) if numbers1[i] <= 0: print("输入数字有误,请输入正负整数") else: break except (ValueError,TypeError): print("输入数字有误,请输入正负整数") x, y, z = numbers1 time1 = list1[time] time2 = dict1.get(time1,'无效值') time3 = time2%6 whole = 6-time3 element=list11[:whole+1] x1,y1,z1= (x-1)%6,(x+y-2)%6,(x+y+z-3)%6 x2,y2,z2 = list2[x1],list2[y1],list2[z1] x3,y3,z3 = list3[x1],list3[y1],list3[z1] x4,y4,z4 = list4[x1],list4[y1],list4[z1] if time3 == 1: list12=list11 elif time3 == 0: list12=['朱雀','勾陈','白虎','玄武','腾蛇','青龙'] else: list12=[x for x in list11 if x not in element]+element x5,y5,z5 = list5[x1],list5[y1],list5[z1] x6,y6,z6 = list12[x1],list12[y1],list12[z1] number1,number2,number3 = dict2.get(x3),dict2.get(y3),dict2.get(z3) list13,list14,list15=globals()[f'list{number1}'],globals()[f'list{number2}'],globals()[f'list{number3}'] x7,y7,z7 =list13[time2-1],list14[time2-1],list15[time2-1] time_len = len(str(time)) if time_len == 1: print('时间','',time,' ',time1) else: print('时间','',time,' ',time1) print(x2,y2,z2) print('',x3,' ',y3,' ',z3) def print_xyz(x,y,z): x_len,y_len,z_len = len(x),len(y),len(z) if x_len == 1 and y_len == 1 and z_len == 1: print('', x, ' ', y, ' ', z) elif x_len == 2 and y_len == 1 and z_len == 1: print(x, '', y, ' ', z) elif x_len == 2 and y_len == 2 and z_len == 1: print(x, y, '', z) elif x_len == 2 and y_len == 1 and z_len == 2: print(x, '', y, '', z) elif x_len == 1 and y_len == 2 and z_len == 1: print('', x, '', y, '', z) elif x_len == 1 and y_len == 2 and z_len == 2: print('', x, '', y, z) elif x_len == 1 and y_len == 1 and z_len == 2: print('', x, ' ', y, '', z) else: print(x, y, z) print_xyz(x4,y4,z4) print(x5,y5,z5) print(x6,y6,z6) print_xyz(x7,y7,z7) input("按下Enter退出")
|