Advertisement
Guest User

Untitled

a guest
Sep 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. while True:
  2. year = int(input("Year: "))
  3. if year < 1583 or year > 9999:
  4. print("Out of range 1583 - 9999")
  5. else:
  6. break
  7.  
  8.  
  9.  
  10. while True:
  11. month = int(input("Month: "))
  12. if month < 1 or month > 12:
  13. print("Out of range 1 - 12")
  14. else:
  15. break
  16.  
  17. yearlist = []
  18. for i in range(1600,9999,100):
  19. yearlist.append(i)
  20.  
  21. if year in yearlist and year % 400 == 0:
  22. a = 1
  23. while a == 1:
  24. day = int(input("Day: "))
  25. if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
  26. and day > 31 or day < 1:
  27. print("Out of allowed range 1 - 31")
  28. elif month == 4 or month == 6 or month == 9 or month == 11 \
  29. and (day > 30 or day < 1):
  30. print("Out of allowed range 1 - 30")
  31. elif month == 2 and day > 29 or day < 1:
  32. print("Out of allowed range 1 - 29")
  33. else:
  34. a = 0
  35. elif year not in yearlist and year % 4 == 0:
  36. a = 1
  37. while a == 1:
  38. day = int(input("Day: "))
  39. if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
  40. and day > 31 or day < 1:
  41. print("Out of allowed range 1 - 31")
  42. elif month == 4 or month == 6 or month == 9 or month == 11 \
  43. and day > 30 or day < 1:
  44. print("Out of allowed range 1 - 30")
  45. elif month == 2 and day > 29 or day < 1:
  46. print("Out of allowed range 1 - 29")
  47. else:
  48. a = 0
  49. else:
  50. a = 1
  51. while a == 1:
  52. day = int(input("Day: "))
  53. if month == 1 or month == 3 or month == 5 or month == 7 or month == 8 or month == 10 or month == 12 \
  54. and day > 31 or day < 1:
  55. print("Out of allowed range 1 - 31")
  56. elif month == 4 or month == 6 or month == 9 or month == 11 \
  57. and day > 30 or day < 1:
  58. print("Out of allowed range 1 - 30")
  59. elif month == 2 and day > 28 or day < 1:
  60. print("Out of allowed range 1 - 28")
  61. else:
  62. a = 0
  63.  
  64. if month == 1 or month == 2:
  65. month += 12
  66. year -= 1
  67.  
  68. zellerscongruence = ( day + 13*(month+1)//5 + year + year//4
  69. - year//100 + year//400 ) % 7
  70.  
  71. if zellerscongruence == 0:
  72. print("It is a Saturday")
  73. if zellerscongruence == 1:
  74. print("It is a Sunday")
  75. if zellerscongruence == 2:
  76. print("It is a Monday")
  77. if zellerscongruence == 3:
  78. print("It is a Tuesday")
  79. if zellerscongruence == 4:
  80. print("It is a Wednesday")
  81. if zellerscongruence == 5:
  82. print("It is a Thursday")
  83. if zellerscongruence == 6:
  84. print("It is a Friday")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement