-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsloknum.py
52 lines (46 loc) · 1.09 KB
/
sloknum.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
from datetime import date
# Generat Bhagavad Gita Chapter and Slok number based on current date
startdate = "2021,10,14"
def Slok_Num():
yy, mm, dd = startdate.split(",")
start = date(int(yy), int(mm), int(dd))
today = date.today()
days = (today - start).days
print(start)
# slokcounts=[47,72,43,42,29,47,30,28,34,42,55,20,35,27,20,24,28,78]
Slok_Count_Till_Chap = [
47,
119,
162,
204,
233,
280,
310,
338,
372,
414,
469,
489,
524,
551,
571,
595,
623,
701,
]
chap, slok = 0, 0
if 702 > days > 0:
for i in range(0, 18):
if days <= Slok_Count_Till_Chap[i]:
chap = i + 1
if i > 0:
slok = days - Slok_Count_Till_Chap[i - 1]
else:
slok = days
break
return (days, chap, slok)
else:
return (days, 0, 0)
if __name__ == "__main__":
# testing th Slok_NUM function
print(Slok_Num())