HEALTH MANGEMENT SYSTEM IN PYTHON DAY 7

 #health management system

#3 client= harry,rohan,hammed
#total 6 files
"""def getdate():
import datetime
return datetime.datetime.now()"""
#write a function that when execute takes as input client name[] chicken roty
"""
import datetime
def gettime():
return datetime.datetime.now()
def take(k):
if k==1:
c=int(input("enter 1 for excersise and 2 for food"))
if(c==1):
value=input("type here\n")
with open("harry-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("harry-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif(k==2):
c = int(input("enter 1 for excersise and 2 for food"))
if (c == 1):
value = input("type here\n")
with open("rohan-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("rohan-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
elif(k==3):
c = int(input("enter 1 for excersise and 2 for food"))
if (c == 1):
value = input("type here\n")
with open("hammad-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("hammad-food.txt", "a") as op:
op.write(str([str(gettime())]) + ": " + value + "\n")
print("successfully written")
else:
print("plz enter valid input (1(harry),2(rohan),3(hammad)")
def retrieve(k):
if k==1:
c=int(input("enter 1 for excersise and 2 for food"))
if(c==1):
with open("harry-ex.txt") as op:
for i in op:
print(i,end="")
elif(c==2):
with open("harry-food.txt") as op:
for i in op:
print(i, end="")
elif(k==2):
c = int(input("enter 1 for excersise and 2 for food"))
if (c == 1):
with open("rohan-ex.txt") as op:
for i in op:
print(i, end="")
elif (c == 2):
with open("rohan-food.txt") as op:
for i in op:
print(i, end="")
elif(k==3):
c = int(input("enter 1 for excersise and 2 for food"))
if (c == 1):
with open("hammad-ex.txt") as op:
for i in op:
print(i, end="")
elif (c == 2):
with open("hammad-food.txt") as op:
for i in op:
print(i, end="")
else:
print("plz enter valid input (harry,rohan,hammad)")
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 harry 2 for rohan 3 for hammad "))
take(b)
else:
b = int(input("press 1 for harry 2 for rohan 3 for hammad "))
retrieve(b)

"""


def gettime():
import datetime
return datetime.datetime.now()


def clients(s):
cl = {'harry': ['roti', 'push-ups'],
'rohan': ['bhindi', 'crunches'],
'hammad': ['chicken', 'heavy lifting']}
diet, exercise = cl[s]
t = gettime()
print('[', t, ']', s, 'eats ', diet, 'and does ', exercise)


name = input('enter the clients name')
name = name.lower()
clients(name)

Comments

Popular posts from this blog

java chapter11 practice question on abstruct class and interfaces

DAY 12 -AZURE DP900(Microsoft Azure Data Fundamentals: Explore non-relational data in Azure)

java exercise4