Description

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


def clients():
    print("1. Nick\n2. John\n3. Doy\n Select Client Name : ")
    n = int(input())
    return n


def lock():
    print("What do You Want to lock \n 1. Diet\n2. Exercise : ")
    lo = int(input())
    return lo


def write_food(file_name):
    f = open(file_name, "a")
    food = input("What do you eat : ")
    d = get_date()
    data = "[" + str(d) + "]\n" + food + "\n"
    f.write(data)
    f.close()


def write_exercise(file_name):
    f = open(file_name, "a")
    exerise = input("What do you Exercise : ")
    d = get_date()
    exe_data = "[" + str(d) + "]\n" + exerise + "\m"
    f.write(exe_data)
    f.close()


def read_food(file_name):
    f = open(file_name, "r")
    print(f.read())
    f.close()


def read_exercise(file_name):
    f = open(file_name, "r")
    print(f.read())
    f.close()


c = clients()
l = lock()
if c == 1:
    if l == 1:
        write_food("1_food.txt")
    else:
        write_exercise("1_exercise.txt")
elif c == 2:
    if l == 1:
        write_food("2_food.txt")
    else:
        write_exercise("2_exercise.txt")
elif c == 3:
    if l == 1:
        write_food("3_food.txt")
    else:
        write_exercise("3_exercise.txt")
else:
    print("NO More Clients.")

print("If You Want to Check Details of Clients then press[1] : ")
s = int(input())

if s == 1:
    cl = clients()
    if cl == 1:
        print("Diet Details\n\n")
        read_food("1_food.txt")
        print("Exercise Details\n\n")
        read_exercise("1_exercise.txt")
    elif cl == 2:
        print("Diet Details\n\n")
        read_food("2_food.txt")
        print("Exercise Details\n\n")
        read_exercise("2_exercise.txt")
    elif cl == 3:
        print("Diet Details\n\n")
        read_food("3_food.txt")
        print("Exercise Details\n\n")
        read_exercise("3_exercise.txt")
    else:
        print("NO More Clients")
else:
    exit(0)

 

Comments

Login is mandatory to comment Please login

Recommended Posts

Find the greatest number given three number by user in python programming

Write a program to check that given three number is by user in Python Programming language.

Calculate the area of circle in Python Programming

In this tutorial, we will learn all about the circle ( area, circumference ) with all types of method. Inbuild Methods, function, simple so on.

leap year in python

The year which has 366 days is called a leap year. This additional day is added in february which makes it 29 days long.

Fibonacci Series | Fibonacci Sequence in Python

Fibonacci numbers ( series ) is a set of numbers that start with 1 or 0 followed by a 1 proceeds on the rule that each number.

Find maximum of two number in python programming language

Maximum of two number in Python - Using max() function , Using if else statement, Using Ternary operator and Using Lambda function.