MCPcopy Create free account
hub / github.com/SR-Sunny-Raj/Hacktoberfest2021-DSA / doomsDay

Function doomsDay

33. Python Programs/doomsDayAlgorithm.py:1–23  ·  view source on GitHub ↗
(year)

Source from the content-addressed store, hash-verified

1def doomsDay(year):
2
3 weekDays = ("Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday")
4
5 k = year % 400
6
7 if(k >= 0 and k < 100):
8 anchor = 2
9
10 elif(k >= 100 and k < 200):
11 anchor = 0
12
13 elif(k >= 200 and k < 300):
14 anchor = 5
15
16 else:
17 anchor = 3
18
19 y = year % 100
20
21 doomsday = ((y//12 + y % 12 + (y % 12)//4)% 7 + anchor) % 7
22
23 return weekDays[doomsday]
24
25year = 2021
26print("Doomsday in the year % s = % s"%(year, doomsDay(year)))

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected