-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise_5.py
100 lines (100 loc) · 3.75 KB
/
exercise_5.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
"""
1. it will ask the user that what he want to do mention his/her dite or exercise
or want to see his progress
2. it will make a seprate file for every user and will also mention the time of the entry
"""
import datetime
import sys
original = sys.stdout
def date ():
return datetime.datetime.now()
u1= "Aman"
u2= "Madhur"
u3= "Ashutosh"
print("************************ Welcome to the health management program **************************")
print("\t\t please enter your username so we can fetch your data")
user = input("\tusername :- ").capitalize()
if user == u1 :
print("\t\t Hi! Aman how can we assist you today ")
print("what you want ? \n 1. Want to see your performance history \n 2. Want to input the a activity")
choice = input()
if choice == "1":
with open("aman.txt",'r') as file:
print(file.read())
with open("aman_dite.txt",'r')as file:
print(file.read())
elif choice == "2":
print("what you want to record ? \n 1. Exercise \n 2. Dite")
option = input()
if option == "1":
with open("aman.txt",'a') as file:
entry=input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
elif option == "2":
with open("aman_dite.txt",'a')as file:
entry = input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
else:
print("sorry the choice is not available")
elif user == u2 :
print("\t\t Hi! Madhur how can we assist you today ")
print("what you want ? \n 1. Want to see your performance history \n 2. Want to input the a activity")
choice = input()
if choice == "1":
with open("madhur.txt",'r') as file:
print(file.read())
with open("madhur_dite.txt",'r')as file:
print(file.read())
elif choice == "2":
print("what you want to record ? \n 1. Exercise \n 2. Dite")
option = input()
if option == "1":
with open("madhur.txt",'a') as file:
entry=input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
elif option == "2":
with open("madhur_dite.txt",'a')as file:
entry = input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
else:
print("sorry the choice is not available")
elif user == u3 :
print("\t\t Hi! Ashutosh how can we assist you today ")
print("what you want ? \n 1. Want to see your performance history \n 2. Want to input the a activity")
choice = input()
if choice == "1":
with open("ashutosh.txt",'r') as file:
print(file.read())
with open("ashutosh_dite.txt",'r') as file:
print(file.read())
elif choice == "2":
print("what you want to record ? \n 1. Exercise \n 2. Dite")
option = input()
if option == "1":
with open("ashutosh.txt",'a') as file:
entry=input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
elif option == "2":
with open("ashutosh_dite.txt",'a') as file:
entry = input()
sys.stdout = file
print(date())
sys.stdout = original
file.write(entry)
else:
print("sorry the choice is not available")