repl.it
@anonymous/

KookyUnwillingFossa

Python

No description

fork
loading
Files
  • main.py
main.py
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
months = [1, 2, 4, 5, 6, 9, 10, 11]
days = months + [15, 20]
years = days + [40, 50, 51, 55, 60]

dates = [
	"1 1 1",
	"20 4 3",
	"15 7 1",
	"51 9 7",
	"70 9 7",
	"20 6 24",
	"47 12 1",
	"60 11 24"
	]

def RomanticDate(date):
	year, month, day = map(int, date.split())
	
	if year not in years:
		new_year = min(years, key=lambda x:x<year)
		return " ".join(map(str, [new_year, 1, 1]))
	elif month not in months:
		new_month = min(months, key=lambda x:x<month)
		if new_month == 1:
			return "".join(map(str, [years[(years.index(year)+1) % len(years)], new_month, 1]))
		else:
			return " ".join(map(str, [year, new_month, 1]))
	elif day not in days:
		new_day = min(days, key=lambda x:x<day)
		if new_day == 1:
			new_month = months[(months.index(month)+1) % len(months)]
			if new_month == 1:
				return " ".join(map(str,[years[(years.index(year)+1) % len(years)], new_month, new_day]))
			else:
				return " ".join(map(str, [year, new_month, new_day]))
		else:
			return " ".join(map(str, [year, month, new_day]))
	else:
		return " ".join(map(str, [year, month, day]))
		
for date in dates:
	print(" => ".join([date, RomanticDate(date)]))
	
Fetching token
?