Skip to content

Commit d84c78b

Browse files
health management system...
1 parent b82a362 commit d84c78b

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

Ex5 HMS.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# Health Management System
2+
# 3 Clients - Ram, Shyam and Rohan
3+
4+
import datetime
5+
def gettime():
6+
return datetime.datetime.now()
7+
def take(k):
8+
if k==1:
9+
c=int(input("enter 1 for excersise and 2 for food"))
10+
if(c==1):
11+
value=input("type here\n")
12+
with open("harry-ex.txt","a") as op:
13+
op.write(str([str(gettime())])+": "+value+"\n")
14+
print("successfully written")
15+
elif(c==2):
16+
value = input("type here\n")
17+
with open("harry-food.txt", "a") as op:
18+
op.write(str([str(gettime())]) + ": " + value + "\n")
19+
print("successfully written")
20+
elif(k==2):
21+
c = int(input("enter 1 for excersise and 2 for food"))
22+
if (c == 1):
23+
value = input("type here\n")
24+
with open("rohan-ex.txt", "a") as op:
25+
op.write(str([str(gettime())]) + ": " + value + "\n")
26+
print("successfully written")
27+
elif (c == 2):
28+
value = input("type here\n")
29+
with open("rohan-food.txt", "a") as op:
30+
op.write(str([str(gettime())]) + ": " + value + "\n")
31+
print("successfully written")
32+
elif(k==3):
33+
c = int(input("enter 1 for excersise and 2 for food"))
34+
if (c == 1):
35+
value = input("type here\n")
36+
with open("hammad-ex.txt", "a") as op:
37+
op.write(str([str(gettime())]) + ": " + value + "\n")
38+
print("successfully written")
39+
elif (c == 2):
40+
value = input("type here\n")
41+
with open("hammad-food.txt", "a") as op:
42+
op.write(str([str(gettime())]) + ": " + value + "\n")
43+
print("successfully written")
44+
else:
45+
print("plz enter valid input (1(harry),2(rohan),3(hammad)")
46+
def retrieve(k):
47+
if k==1:
48+
c=int(input("enter 1 for excersise and 2 for food"))
49+
if(c==1):
50+
with open("harry-ex.txt") as op:
51+
for i in op:
52+
print(i,end="")
53+
elif(c==2):
54+
with open("harry-food.txt") as op:
55+
for i in op:
56+
print(i, end="")
57+
elif(k==2):
58+
c = int(input("enter 1 for excersise and 2 for food"))
59+
if (c == 1):
60+
with open("rohan-ex.txt") as op:
61+
for i in op:
62+
print(i, end="")
63+
elif (c == 2):
64+
with open("rohan-food.txt") as op:
65+
for i in op:
66+
print(i, end="")
67+
elif(k==3):
68+
c = int(input("enter 1 for excersise and 2 for food"))
69+
if (c == 1):
70+
with open("hammad-ex.txt") as op:
71+
for i in op:
72+
print(i, end="")
73+
elif (c == 2):
74+
with open("hammad-food.txt") as op:
75+
for i in op:
76+
print(i, end="")
77+
else:
78+
print("plz enter valid input (harry,rohan,hammad)")
79+
print("health management system: ")
80+
a=int(input("Press 1 for log the value and 2 for retrieve "))
81+
82+
if a==1:
83+
b = int(input("Press 1 for harry 2 for rohan 3 for hammad "))
84+
take(b)
85+
else:
86+
b = int(input("Press 1 for harry 2 for rohan 3 for hammad "))
87+
retrieve(b)
88+

0 commit comments

Comments
 (0)