Health management System - Project

 Copy from Other:-

def getdate():
    import datetime
    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("Enter Exercise name: ")
            with open("harry_exercise.txt","a") as op:
                op.write(str([str(getdate())])+": "+value+"\n")
            print("successfuly written ")
        elif(c==2):
            value=input("Enter food name: ")
            with open("harry_food.txt", "a") as op:
                op.write(str([str(getdate())]) + ": " + value + "\n")
        print("successfully written")

    elif(k==2):
        c=int(input("enter 1 for exercise and 2 for food"))
        if(c==1):
            value=input("Enter exercise name: ")
            with open("rohan_exercise.txt","a") as op:
                op.write(str([str(getdate())]) + ": " + value + "\n")
            print("successfuly written")

        elif(c==2):
            value=input("Enter food name: ")
            with open("rohan_food.txt","a") as op:
                op.write(str([str(getdate())]) + ": " + value + "\n")
            print("successfuly written")

    elif(k==3):
        c=int(input("enter 1 for exercise and 2 for food"))
        if(c==1):
            value=input("Enter exercise name: ")
            with open("hammed_exercise.txt","a") as op:
                op.write(str([str(getdate())]) + ": " + value + "\n")
            print("successfuly written")
        elif(c==2):
            value = input("Enter Food name: ")
            with open("hammed_food.txt", "a") as op:
                op.write(str([str(getdate())]) + ": " + value + "\n")
            print("successfuly 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 exercise and 2 for food"))
        if(c==1):
            with open("harry_exercise.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 exercise and 2 for food"))
        if (c == 1):
            with open("rohan_exercise") 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 exercise and 2 for food"))
        if (c == 1):
            with open("hammed_exercise") as op:
                for i in op:
                    print(i, end="")
        elif (c == 2):
            with open("hammed_food.txt") as op:
                for i in op:
                    print(i, end="")
    else:
        print("plz enter valid input")

print("Health Management System")
a=int(input("Press 1 for log 2 for retrieve"))

if a==1:
    b=int(input("Press 1 for harry 2 for rohan 2 for hammad "))
    take(b)
else:
    b=int(input("Press 1 for harry 2 for rohan 3 for hammad "))
    retrieve(b)


This is Mine source code:-

# Health management system
def getdate():
import datetime
return datetime.datetime.now()
def log():
while True:
print('''
1.Harry
2.Rohan
3.Hammad''')
client=int(input("Enter client Number: "))
if client==1:
que=int(input('''
what do you want to log
1.Food
2.Exercise'''))
if que==1:
food=input("Enter Food Name: ")
with open("harry_food.txt","a") as d:
d.write(str([str(getdate())]) + ": " + food + "\n")
print("written Successfuly!")

elif que==2:
exercise=input("Enter Exercise Name: ")
with open("harry_exercise.txt","a") as d:
d.write(str([str(getdate())]) + ": " + exercise + "\n")
print("written successfuly!")

elif client==2:
que = int(input('''
what do you want to log
1.Food
2.Exercise'''))
if que == 1:
food = input("Enter Food Name: ")
with open("rohan_food.txt", "a") as d:
d.write(str([str(getdate())]) + ": " + food + "\n")
print("written Successfuly!")

elif que == 2:
exercise = input("Enter Exercise Name: ")
with open("rohan_exercise.txt", "a") as d:
d.write(str([str(getdate())]) + ": " + exercise + "\n")
print("written successfuly!")


elif client==3:
que = int(input('''
what do you want to log
1.Food
2.Exercise'''))
if que == 1:
food = input("Enter Food Name: ")
with open("hammed_food.txt", "a") as d:
d.write(str([str(getdate())]) + ": " + food + "\n")
print("written Successfuly!")

elif que == 2:
exercise = input("Enter Exercise Name: ")
with open("hammed_exercise.txt", "a") as d:
d.write(str([str(getdate())]) + ": " + exercise + "\n")
print("written successfuly!")

ans=input('''
Do you want to add more Log(Yes/No)
Y
N:''')
if ans=='n':
print("Good bye! See you later")
break


def retrieve():
while True:

print('''
1.Harry
2.Rohan
3.Hammad''')
client = int(input("Enter client Number: "))
if client==1:
que = int(input('''
what do you want to Retrieve
1.Food
2.Exercise'''))
if que==1:
with open("harry_food.txt") as d:
for file in d:
print(file)

elif que==2:
with open("harry_exercise.txt") as d:
for file in d:
print(file)

elif client==2:
que = int(input('''
what do you want to Retrieve
1.Food
2.Exercise'''))
if que == 1:
with open("rohan_food.txt") as d:
for file in d:
print(file)

elif que == 2:
with open("rohan_exercise.txt") as d:
for file in d:
print(file)

elif client==3:
que = int(input('''
what do you want to Retrieve
1.Food
2.Exercise'''))
if que == 1:
with open("hammed_food.txt") as d:
for file in d:
print(file)

elif que == 2:
with open("hammed_exercise.txt") as d:
for file in d:
print(file)


ans=input('''
Do you want to Retrieve Again (yes/no)
Y
N :''')
if ans=='n':
print("Good Bye! See you later")
break



while True:
print("welcome to Health Management System")
choice=int(input('''
What do you want to
1.Log
2.Retrieve :'''))
if choice==1:
log()
elif choice==2:
retrieve()

else:
print('''
Sorry your choice is wrong!
Try again!''')
ans=input("Do you want to do Log OR Retrieve Again(yes/no)\nY\nN : ")
if ans=='n':
print("Good Bye! See you later")
break































Comments

Popular posts from this blog

Become Healthy Goal - Python Program

Calculator in C++

Interpretation vs Compilation