-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhealth_man_system.py
127 lines (96 loc) · 3.41 KB
/
health_man_system.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#health management system
# 3 clients - Harry, Rohan, Hammad
import datetime
def getdate():
return datetime.datetime.now()
def select_name():
name = {1:"Harry", 2:"Rohan", 3:"Hammad"}
data = {1:"Diet", 2:"Exercise"}
for key, value in name.items():
print("press", key, "for", value, "\n", end="")
n = int(input("\nSelect Name:\n"))
if n>3:
print("Error, select 1 or 2 !")
exit()
else:
return n
def select_file_action():
a = {1:"Log", 2:"Retrieve"}
for key, value in a.items():
print("Press", key, "for", value, "\n", end="")
x= int(input("Select Action:\n"))
if x>2:
print("Error, select 1 or 2 !")
exit()
else:
return x
def select_task():
b = {1:"Food", 2:"Exercise"}
for key, value in b.items():
print("Press", key, "for", value, "\n", end="")
y = int(input("Select task:\n"))
if y>2:
print("Error, select 1 or 2 !")
exit()
else:
return y
def action(n, x, y):
# condition no 1
if n == 1 and x == 1 and y == 1:
value = input("type here\n")
with open("Harry_diet.txt", "a") as Harry_diet:
# printing date and time
Harry_diet.write(str([str(getdate())]) + ": " + value + "\n")
print("successfully written")
# condition no 2
elif n == 1 and x == 1 and y == 2:
value = input("type here\n")
# printing date and time
with open("Harry_exercise.txt", "a") as Harry_exercise:
# printing date and time
Harry_exercise.write(str([str(getdate())]) + ": " + value + "\n")
print("successfully written")
# condition 3
elif n == 2 and x == 1 and y == 1:
value = input("type here\n")
# printing date and time
with open("Rohan_diet.txt", "a") as Rohan_diet:
# printing date and time
Rohan_diet.write(str([str(getdate())]) + ": " + value + "\n")
print("successfully written")
# condition 4
elif n == 2 and x == 1 and y == 2:
value = input("type here\n")
# printing date and time
with open("Rohan_exercise.txt", "a") as Rohan_exercise:
# printing date and time
Rohan_exercise.write(str([str(getdate())]) + ": " + value + "\n")
print("successfully written")
# condition 5
elif n == 1 and x == 2 and y == 1:
# printing date and time
with open("Harry_diet.txt", "r") as Harry_diet:
a = Harry_diet.read()
print(a)
# condition no 6
elif n == 1 and x == 2 and y == 2:
# printing date and time
with open("Harry_exercise.txt", "r") as Harry_exercise:
a = Harry_exercise.read()
print(a)
# condition no 7
elif n == 2 and x == 2 and y == 1:
# printing date and time
with open("Rohan_diet.txt", "r") as Rohan_diet:
a = Rohan_diet.read()
print(a)
# condition no 8
elif n == 2 and x == 2 and y == 2:
# printing date and time
with open("Rohan_exercise.txt", "r") as Rohan_exercise:
a = Rohan_exercise.read()
print(a)
n = select_name()
x = select_file_action()
y = select_task()
action(n, x, y)