forked from ndleah/python-mini-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (52 loc) · 945 Bytes
/
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
45
46
47
48
49
50
51
52
53
54
55
date=input("Enter DD/MM/YYYY: ").split('/')
d=int(date[0])
m=int(date[1])
y=int(date[2])
er=0
def leapyr(y):
if(y%4==0 and (y%100!=0 or y%400==0)):
return True
return False
if(m==1 or m==3 or m==5 or m==7 or m==8 or m==10 or m==12):
if(d<31):
d+=1
if(d==31 and m!=12):
d=1
m+=1
if(d==31 and m==12):
d=1
m=1
y+=1
if(d>31):
er=1
elif(m==4 or m==6 or m==9 or m==11):
if(d<30):
d+=1
if(d==30):
d=1
m+=1
if(d>30):
er=1
elif(m==2):
if(leapyr(y)):
if(d==29):
m+=1
d=1
if(d<29):
d+=1
if(d>29):
er=1
else:
if(d==28):
m+=1
d=1
if(d<28):
d+=1
if(d>28):
er=1
else:
er=1
if(er==1):
print("INVALID INPUT")
else:
print("The next date is {}/{}/{}".format(d,m,y))