-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExcercise5_HealthManagementSystem.py
More file actions
62 lines (54 loc) · 1.93 KB
/
Excercise5_HealthManagementSystem.py
File metadata and controls
62 lines (54 loc) · 1.93 KB
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
# Health Management System:-
"""
3 clients --> Zidane,Shamsher,Uzma
create 3 file for Food Lock
and create 3 file for Excercise Lock
Create total 6 files
Write a function that when executed take as input client name
def getdate():
import datetime
return datetime.datetime.now()
this function is given
"""
client_list = {1: "Harry", 2: "Rohan", 3: "Hammad"}
lock_list = {1: "Exercise", 2: "Diet"}
def getdate():
import datetime
return datetime.datetime.now()
try:
print("Select Client Name:")
for key, value in client_list.items():
print("Press", key, "for", value, "\n", end="")
client_name = int(input())
print("Selected Client : ", client_list[client_name], "\n", end="")
print("Press 1 for Lock")
print("Press 2 for Retrieve")
op = int(input())
if op is 1:
for key, value in lock_list.items():
print("Press", key, "to lock", value, "\n", end="")
lock_name = int(input())
print("Selected Job : ", lock_list[lock_name])
f = open(client_list[client_name] + "_" + lock_list[lock_name] + ".txt", "a")
k = 'y'
while (k is not "n"):
print("Enter", lock_list[lock_name], "\n", end="")
mytext = input()
f.write("[ " + str(getdate()) + " ] : " + mytext + "\n")
k = input("ADD MORE ? y/n:")
continue
f.close()
elif op is 2:
for key, value in lock_list.items():
print("Press", key, "to retrieve", value, "\n", end="")
lock_name = int(input())
print(client_list[client_name], "-", lock_list[lock_name], "Report :", "\n", end="")
f = open(client_list[client_name] + "_" + lock_list[lock_name] + ".txt", "rt")
contents = f.readlines()
for line in contents:
print(line, end="")
f.close()
else:
print("Invalid Input !!!")
except Exception as e:
print("Wrong Input !!!")