-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest2.py
More file actions
132 lines (126 loc) · 3.88 KB
/
Test2.py
File metadata and controls
132 lines (126 loc) · 3.88 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
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
129
130
131
132
# CodeWithHarry
# Exercise 5
def getdate():
import datetime
return datetime.datetime.now()
def FoodExerciseFile():
print("File Option:")
print("1. Food\n2. Exercise")
global ch2
ch2 = int(input("Enter your choice: "))
f = open("HarryFood.txt", "w")
f.write("Harry's Food\n")
f.close()
f = open("HarryExercise.txt", "w")
f.write("Harry's Exercise\n")
f.close()
f = open("RohanFood.txt", "w")
f.write("Rohan's Food\n")
f.close()
f = open("RohanExercise.txt", "w")
f.write("Rohan's Exercise\n")
f.close()
f = open("HammadFood.txt", "w")
f.write("Hammad's Food\n")
f.close()
f = open("HammadExercise.txt", "w")
f.write("Hammad's Exercise\n")
f.close()
ch3 = "y"
while(ch3 == "y" or ch3 == "Y"):
print("HEALTH MANAGEMENT SYSTEM")
print("1. Harry\n2. Rohan\n3. Hammad")
ch1 = int(input("Enter your choice(1-3): "))
if(ch1 == 1):
FoodExerciseFile()
if(ch2 == 1):
f = open("HarryFood.txt", "a")
food = input("Enter the food: ")
f.write(str(getdate()))
f.write(" ")
f.write(food)
f.close()
if(ch2 == 2):
f = open("HarryExercise.txt", "a")
exercise = input("Enter the exercise: ")
f.write(str(getdate()))
f.write(" ")
f.write(exercise)
f.close()
if(ch1 == 2):
FoodExerciseFile()
if(ch2 == 1):
f = open("RohanFood.txt", "a")
food = input("Enter the food: ")
f.write(str(getdate()))
f.write(" ")
f.write(food)
f.close()
if(ch2 == 2):
f = open("RohanExercise.txt", "a")
exercise = input("Enter the exercise: ")
f.write(str(getdate()))
f.write(" ")
f.write(exercise)
f.close()
if(ch1 == 3):
FoodExerciseFile()
if(ch2 == 1):
f = open("HammadFood.txt", "a")
food = input("Enter the food: ")
f.write(str(getdate()))
f.write(" ")
f.write(food)
f.close()
if(ch2 == 2):
f = open("HammadExercise.txt", "a")
exercise = input("Enter the exercise: ")
f.write(str(getdate()))
f.write(" ")
f.write(exercise)
f.close()
ch4 = input("Do you want to retrieve data?")
if(ch4 == "y" or ch4 == "Y"):
print("1. Harry\n2. Rohan\n3. Hammad")
ch1 = int(input("Enter your choice(1-3): "))
if(ch1 == 1):
FoodExerciseFile()
if(ch2 == 1):
f = open("HarryFood.txt", "r")
hfood = f.read()
print(hfood)
f.close()
if(ch2 == 2):
f = open("HarryExercise.txt", "r")
hexercise = f.read()
print(hexercise)
f.close()
if(ch1 == 2):
FoodExerciseFile()
if(ch2 == 1):
f = open("RohanFood.txt", "r")
rfood = f.read()
print(rfood)
f.close()
if(ch2 == 2):
f = open("RohanExercise.txt", "r")
rexercise = f.read()
print(rexercise)
f.close()
if(ch1 == 3):
FoodExerciseFile()
if(ch2 == 1):
f = open("HammadFood.txt", "r")
hafood = f.read()
print(hafood)
f.close()
if(ch2 == 2):
f = open("HammadExercise.txt", "r")
haexercise = f.read()
print(haexercise)
f.close()
if(ch4 == "n" or ch4 == "N"):
exit
ch3 = input("Do you want to continue(y/n)")
if(ch3 == "n" or ch3 == "N"):
exit