12.Gym Management System.py

# Health Management System

# 3 clients - Harry, Merry, Jerry

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


# Total 6 files
# write a function that when executed takes as input client name
# [Time] chicken,roti


# One more function to retrieve exercise or food for any client
# ask user to lock or not
# then ask for whom to lock: Harry/Merry/Jerry
# what to lock Exercise or diet
# Write a message that (f"File Written Successfully for {Name}")


def take(k):
if k == 1:
c = int(input("Enter 1 for Exercise and 2 Diet"))
if c == 1:
value = input("Type here\n")
with open("Harry_ex.txt", "a") as op:
op.write(str([str(getdate())]) + ": " + value + "\n")
print("Successfully Written")
elif c == 2:
value = input("Type here\n")
with open("Harry_diet.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 Diet"))
if c == 1:
value = input("Type here\n")
with open("Merry_ex.txt", "a") as op:
op.write(str([str(getdate())]) + ": " + value + "\n")
print("Successfully Written")
elif c == 2:
value = input("Type here\n")
with open("Merry_diet.txt", "a") as op:
op.write(str([str(getdate())]) + ": " + value + "\n")
print("Successfully Written")

elif k == 3:
c = int(input("Enter 1 for Exercise and 2 Diet"))
if c == 1:
value = input("Type here\n")
with open("Jerry_ex.txt", "a") as op:
op.write(str([str(getdate())]) + ": " + value + "\n")
print("Successfully Written")
elif c == 2:
value = input("Type here\n")
with open("Jerry_diet.txt", "a") as op:
op.write(str([str(getdate())]) + ": " + value + "\n")
print("Successfully Written")

else:
print("Please check the input: Enter 1 for Harry, Enter 2 for Merry, Enter 3 for Jerry")


def retrieve(k):
if k == 1:
c = int(input("Enter 1 for Exercise and 2 Diet"))
if c == 1:
with open("Harry_ex.txt", "r") as op:
for i in op:
print(i, end=" ")
elif c == 2:
with open("Harry_diet.txt", "r") as op:
for i in op:
print(i, end=" ")

elif k == 2:
c = int(input("Enter 1 for Exercise and 2 Diet"))
if c == 1:
with open("Merry_ex.txt", "r") as op:
for i in op:
print(i, end=" ")
elif c == 2:
with open("Merry_diet.txt", "r") as op:
for i in op:
print(i, end=" ")

elif k == 3:
c = int(input("Enter 1 for Exercise and 2 Diet"))
if c == 1:
with open("Jerry_ex.txt", "r") as op:
for i in op:
print(i, end=" ")
elif c == 2:
with open("Jerry_diet.txt", "r") as op:
for i in op:
print(i, end=" ")

else:
print("Please check the input: Enter 1 for Harry, Enter 2 for Merry, Enter 3 for Jerry")


print("Health management System: ")
a = int(input("Press 1 for log the value and 2 for retrieve"))

if a == 1:
b = int(input("Enter 1 for Harry, Enter 2 for Merry, Enter 3 for Jerry"))
take(b)
elif a == 2:
b = int(input("Enter 1 for Harry, Enter 2 for Merry, Enter 3 for Jerry"))
retrieve(b)
else:
print("Wrong Choice Entered! Press 1 for log the value and 2 for retrieve")

Comments

Popular posts from this blog

17.Tic-Tac-Toe.py

15.PyStopWatch.py