-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
108 lines (80 loc) · 2.14 KB
/
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import csv
from datetime import datetime
import time
now = datetime.now()
date = now.day
day = now.strftime("%A")
month = now.strftime("%B")
year = now.year
nowtime = datetime.now().time()
target_time = datetime.strptime("19:00:00", "%H:%M:%S").time()
def countdown():
for i in range(5, 0, -1):
print(i)
time.sleep(1)
def later():
print('Okay Good Luck')
return
def is_data_exist_for_today():
with open('reportmood.csv', 'r') as file:
reader = csv.reader(file)
for row in reader:
if row[2] == day and (row[1]) == month and int(row[3]) == year:
return True
return False
def time_to_report():
if nowtime >= target_time:
return False
else:
return True
def Mood ():
if is_data_exist_for_today():
print("You already report mood.")
countdown()
return
data = [
[date,month,day,year,'Mood']
# ['Date','Month','Day','Year','Mood']
]
file = open('reportmood.csv', 'a', newline='')
write = csv.writer(file)
write.writerows(data)
print('Yeayy nice bro. hope tommorow your mood same like today')
countdown()
def NotMood ():
if is_data_exist_for_today():
print("You already report mood.")
countdown()
return
data = [
[date,month,day,year,'Not Mood']
# ['Date','Month','Day','Year','Mood']
]
file = open('reportmood.csv', 'a', newline='')
write = csv.writer(file)
write.writerows(data)
print('Ah Hope you get mood better')
countdown()
def selection():
if is_data_exist_for_today():
print("You already report mood.")
countdown()
return
if time_to_report():
print("Report Mood Closed.come back on 7:00PM/19:00")
countdown()
return
print('What your mood today:')
print('1. Mood')
print('2. Not Mood')
print('3. Later')
selection=int(input("Enter your choice: "))
if selection==1:
Mood()
elif selection==2:
NotMood()
elif selection==3:
later()
else:
print('Invalid Choice')
selection()