We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 40421f6 commit 2a98d10Copy full SHA for 2a98d10
Problem Set 3/outdated/outdated.py
@@ -0,0 +1,37 @@
1
+months = [
2
+ "January",
3
+ "February",
4
+ "March",
5
+ "April",
6
+ "May",
7
+ "June",
8
+ "July",
9
+ "August",
10
+ "September",
11
+ "October",
12
+ "November",
13
+ "December"
14
+]
15
+
16
+while True:
17
+ date = input("Date: ").strip()
18
+ try:
19
+ month, day, year = date.split('/')
20
+ if 1 <= int(month) <= 12 and 1 <= int(day) <= 31:
21
+ break
22
+ except:
23
24
+ if ',' in date:
25
+ old_month, old_day, year = date.split(" ")
26
27
+ for i in range(len(months)):
28
+ if old_month == months[i]:
29
+ month = i + 1
30
+ day = old_day.replace(",", "").strip()
31
+ year = year.strip()
32
33
34
35
+ pass
36
37
+print(f"{year}-{int(month):02}-{int(day):02}")
0 commit comments