-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquiz5.py
More file actions
85 lines (83 loc) · 3.1 KB
/
quiz5.py
File metadata and controls
85 lines (83 loc) · 3.1 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import datetime
def gettime():
return datetime.datetime.now()
def take(k):
if k==1:
c=int(input("enter 1 for exercise and 2 for food"))
if(c==1):
value=input("type here\n")
with open("lewis-ex.txt","a") as op:
op.write(str([str(gettime())])+": "+value+"\n")
print("successfully written")
elif(c==2):
value = input("type here\n")
with open("lewis-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif(k==2):
c = int(input("enter 1 for exercise and 2 for food"))
if (c == 1):
value = input("type here\n")
with open("shaw-ex.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif (c == 2):
value = input("type here\n")
with open("shaw-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif(k==3):
c = int(input("enter 1 for exercise and 2 for food"))
if (c == 1):
value = input("type here\n")
with open("ansh-ex.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif (c == 2):
value = input("type here\n")
with open("ansh-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
else:
print("plz enter valid input (1(lewis),2(shaw),3(ansh)")
def retrieve(k):
if k==1:
c=int(input("enter 1 for exercise and 2 for food"))
if(c==1):
with open("lewis-ex.txt") as op:
for i in op:
print(i,end="")
elif(c==2):
with open("lewis-food.txt") as op:
for i in op:
print(i, end="")
elif(k==2):
c = int(input("enter 1 for exercise and 2 for food"))
if (c == 1):
with open("shaw-ex.txt") as op:
for i in op:
print(i, end="")
elif (c == 2):
with open("shaw-food.txt") as op:
for i in op:
print(i, end="")
elif(k==3):
c = int(input("enter 1 for exercise and 2 for food"))
if (c == 1):
with open("ansh-ex.txt") as op:
for i in op:
print(i, end="")
elif (c == 2):
with open("ansh-food.txt") as op:
for i in op:
print(i, end="")
else:
print("plz enter valid input (lewis,shaw,ansh)")
print("health management system: ")
a=int(input("press 1 for log the value and 2 for retrieve "))
if a==1:
b = int(input("press 1 for lewis 2 for shaw 3 for ansh "))
take(b)
else:
b = int(input("press 1 for lewis 2 for shaw 3 for ansh "))
retrieve(b)