# Time 5, Exercise 2: converting year numbers between systems def ad_to_auc(year): """AD year (positive) to 'years from the founding of Rome'. AD 1 = 754 AUC.""" return year + 753 def bc_to_auc(bc): """BC year to AUC. 1 BC = 753 AUC, 753 BC = 1 AUC.""" return 754 - bc def bc_to_astronomical(bc): """Astronomers count a year 0, so 1 BC = 0, 2 BC = -1 and so on.""" return 1 - bc def japanese_era(year): """Gregorian year to modern Japanese era year (full years only, ignoring the January/May split).""" eras = [("Reiwa", 2019), ("Heisei", 1989), ("Showa", 1926), ("Taisho", 1912), ("Meiji", 1868)] for name, start in eras: if year >= start: return name + " " + str(year - start + 1) return "before Meiji" print("2026 AD =", ad_to_auc(2026), "AUC") print("Rome's founding year, 753 BC =", bc_to_auc(753), "AUC") print("44 BC (Caesar) =", bc_to_auc(44), "AUC") print("44 BC in astronomical numbering:", bc_to_astronomical(44)) print("Span from 1 BC to AD 1:", 1 - bc_to_astronomical(1), "year (there is no year 0 on the BC/AD scale)") for y in (1926, 1989, 2000, 2019, 2026): print(y, "->", japanese_era(y)) # Output when run: # 2026 AD = 2779 AUC # Rome's founding year, 753 BC = 1 AUC # 44 BC (Caesar) = 710 AUC # 44 BC in astronomical numbering: -43 # Span from 1 BC to AD 1: 1 year (there is no year 0 on the BC/AD scale) # 1926 -> Showa 1 # 1989 -> Heisei 1 # 2000 -> Heisei 12 # 2019 -> Reiwa 1 # 2026 -> Reiwa 8 # Reading the output: the AD-to-AUC conversion is just "add 753". Japanese era years are # "Gregorian year minus the era's first year, plus one". Real era changes happen on a # particular day (8 January 1989, 1 May 2019), so 1989 and 2019 hold two eras; the # function above gives the era that began that year.