Become Healthy Goal - Python Program
def gettime():
import time
return time.asctime(time.localtime(time.time()))
def log():
while True:
choice = int(input("Enter 1 for Diet, 2 for exercise: "))
if choice==1:
diet=input("Enter Food Name: ")
with open("deep-food.txt","a") as d:
d.write(str([str(gettime())]) + ": " + diet)
print("Add successfuly!")
elif choice==2:
exercise=input("Enter Exercise Name: ")
with open("deep-exercise.txt","a") as d:
d.write(str([str(gettime())]) + ": " + exercise)
print("Add Successfuly!")
ans=input("Do you want to add 'diet or exercise'\nType Y for yes and Type N for no: ")
if ans=='n':
print("Good bye!")
break
def retreive():
while True:
choice=int(input("What do you want to retreive 1.Diet or 2.Exercise: "))
if choice==1:
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Diet Plan~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
with open("deep-food.txt") as d:
for item in d:
print(item)
elif choice==2:
print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Exercise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
with open("deep-exercise.txt") as d:
for item in d:
print(item)
ans=input("Do you want to view Again you record\nType y for yes and n for no: ")
if ans=='n':
print("Good bye!")
break
while True:
print("Hy,\nBecome health and stay discipline")
choice=int(input("What do you want to 1.Log or 2.Retrieve: "))
if choice==1:
log()
elif choice==2:
retreive()
ans=input("Do you want to do Log or retreive again!\nType y for yes and Type n for no: ")
if ans=='n':
print("Good bye!")
break
Comments
Post a Comment