看到有些天干地支的匹配是不对的,不是简单的for - for循环 而是配对出现的
a = ['甲','乙','丙','丁','戊','己','庚','辛','壬','癸'] b = ['子','丑','寅','卯','辰','巳','午','未','申','酉','戌','亥'] i = 0 j = 0 lap = 0 while j <= len(b): c = [a[i],b[j]] print('{:2} {:2} {}'.format(i,j,c)) j += 1 i += 1 if i == len(a) and j == len(b): break if j == len(b): j %= len(b) if i == len(a): i %= len(a) lap += 1 print(' lap ============ ',lap)
输出