Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- year = int(input("Year: "))
- if year < 1583 or year > 9999:
- print("Out of range 1583 - 9999")
- else:
- break
- while True:
- month = int(input("Month: "))
- if month < 1 or month > 12:
- print("Out of range 1 - 12")
- else:
- break
- yearlist = []
- for i in range(1600,9999,100):
- yearlist.append(i)
- if year in yearlist and year % 400 == 0:
- a = 1
- while a == 1:
- day = int(input("Day: "))
- if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
- and day > 31 or day < 1:
- print("Out of allowed range 1 - 31")
- elif month == 4 or month == 6 or month == 9 or month == 11 \
- and (day > 30 or day < 1):
- print("Out of allowed range 1 - 30")
- elif month == 2 and day > 29 or day < 1:
- print("Out of allowed range 1 - 29")
- else:
- a = 0
- elif year not in yearlist and year % 4 == 0:
- a = 1
- while a == 1:
- day = int(input("Day: "))
- if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
- and day > 31 or day < 1:
- print("Out of allowed range 1 - 31")
- elif month == 4 or month == 6 or month == 9 or month == 11 \
- and day > 30 or day < 1:
- print("Out of allowed range 1 - 30")
- elif month == 2 and day > 29 or day < 1:
- print("Out of allowed range 1 - 29")
- else:
- a = 0
- else:
- a = 1
- while a == 1:
- day = int(input("Day: "))
- if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
- and day > 31 or day < 1:
- print("Out of allowed range 1 - 31")
- elif month == 4 or month == 6 or month == 9 or month == 11 \
- and day > 30 or day < 1:
- print("Out of allowed range 1 - 30")
- elif month == 2 and day > 28 or day < 1:
- print("Out of allowed range 1 - 28")
- else:
- a = 0
- if month == 1 or month == 2:
- month += 12
- year -= 1
- zellerscongruence = ( day + 13*(month+1)//5 + year + year//4
- - year//100 + year//400 ) % 7
- if zellerscongruence == 0:
- print("It is a Saturday")
- if zellerscongruence == 1:
- print("It is a Sunday")
- if zellerscongruence == 2:
- print("It is a Monday")
- if zellerscongruence == 3:
- print("It is a Tuesday")
- if zellerscongruence == 4:
- print("It is a Wednesday")
- if zellerscongruence == 5:
- print("It is a Thursday")
- if zellerscongruence == 6:
- print("It is a Friday")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement