-
Notifications
You must be signed in to change notification settings - Fork 0
/
Health_managment_system.py
128 lines (118 loc) · 4.19 KB
/
Health_managment_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
128
def getdate():
import datetime
a=datetime.datetime.now()
return a
def get_name(n): ##Function for accepting client name#
if(n==1):
print("whether you want to retrieve(2) or add(1)")
d=int(input())
if(d==1):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if(c==1): #to add food item
print("what do you want to add in food")
food_add=input()
f=open("harry_food.txt","a")
f.write(str(getdate())+":"+food_add+"\n")
print("successfully written")
f.close()
##to add exercise done
if(c==2):
print("what do you want to add in exercise")
exercise_add=input()
f=open("harry_exercise.txt","a")
f.write(str(getdate())+":"+exercise_add+"\n")
print("successfully written")
f.close()
##to read the content in the file
elif(d==2):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if (c == 1):
f = open("harry_food.txt")
b=f.read()
print(b)
f.close()
if (c == 2):
f = open("harry_exercise.txt")
b = f.read()
print(b)
f.close()
## to read and write the content to Rohan
if (n == 2):
print("whether you want to retrieve(2) or add(1)")
d = int(input())
if (d == 1):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if (c == 1):
print("what do you want to add in food")
food_add = input()
f = open("Rohan_food.txt", "a")
f.write(str(getdate())+":"+food_add+"\n")
print("successfully written")
f.close()
if (c == 2):
print("what do you want to add in exercise")
exercise_add = input()
f = open("Rohan_exercise.txt", "a")
f.write(str(getdate()) + ":" + exercise_add + "\n")
print("successfully written")
f.close()
elif (d == 2):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if (c == 1):
f = open("Rohan_food.txt")
b = f.read()
print(b)
f.close()
if (c == 2):
f = open("Rohan_exercise.txt")
b = f.read()
print(b)
f.close()
##to read and write the content of Hamad
if (n == 3):
print("whether you want to retrieve(2) or add(1)")
d = int(input())
if (d == 1):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if (c == 1):
print("what do you want to add in food")
food_add = input()
f = open("Hamad_food.txt", "a")
f.write(str(getdate()) + ":" + food_add + "\n")
print("successfully written")
f.close()
if (c == 2):
print("what do you want to add in exercise")
exercise_add = input()
f = open("Hamad_exercise.txt", "a")
f.write(str(getdate())+":"+exercise_add+"\n")
print("successfully written")
f.close()
elif (d == 2):
print("Enter 1 for food or 2 for exercise")
c = int(input())
if (c == 1):
f = open("Hamad_food.txt")
b = f.read()
print(b)
f.close()
if (c == 2):
f = open("Hamad_exercise.txt")
b = f.read()
print(b)
f.close()
print("enter the number of client whose data you want","\n","1.Harry","\n","2.Rohan","\n","3.Hamad")
roll_no=int(input())
if(roll_no==1):
get_name(1)
elif(roll_no==2):
get_name(2)
elif(roll_no==3):
get_name(3)
else:
print("details not available")