Advertisement
Priyanshu_Gupta

Health Management System

Aug 21st, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.67 KB | None | 0 0
  1. # Health Management System
  2. client_list = {1: "Harry", 2: "Rohan", 3: "Hammad"}
  3. log_list = {1: "Exercise", 2: "Diet"}
  4.  
  5.  
  6. def getdate():
  7.     import datetime
  8.     return datetime.datetime.now()
  9.  
  10.  
  11. try:
  12.     print("Select Client Name:")
  13.     for key, value in client_list.items():
  14.         print("Press", key, "for", value, "\n", end="")
  15.     client_name = int(input())
  16.  
  17.     print("Selected Client : ", client_list[client_name], "\n", end="")
  18.  
  19.     print("Press 1 for Log")
  20.     print("Press 2 for Retrieve")
  21.     op = int(input())
  22.  
  23.     if op is 1:
  24.         for key, value in log_list.items():
  25.             print("Press", key, "to log", value, "\n", end="")
  26.         log_name = int(input())
  27.         print("Selected Job : ", log_list[log_name])
  28.         f = open(client_list[client_name] + "_" + log_list[log_name] + ".txt", "a")
  29.         k = 'y'
  30.         while (k is not "n"):
  31.             print("Enter", log_list[log_name], "\n", end="")
  32.             mytext = input()
  33.             f.write("[ " + str(getdate()).replace(":", "-") + " ] : " + mytext + "\n")
  34.             k = input("ADD MORE ? y/n:")
  35.             continue
  36.         f.close()
  37.     elif op is 2:
  38.         for key, value in log_list.items():
  39.             print("Press", key, "to retrieve", value, "\n", end="")
  40.         log_name = int(input())
  41.         print(client_list[client_name], "-", log_list[log_name], "Report :", "\n", end="")
  42.         f = open(client_list[client_name] + "_" + log_list[log_name] + ".txt", "rt")
  43.         contents = f.readlines()
  44.         for line in contents:
  45.             print(line, end="")
  46.         f.close()
  47.     else:
  48.         print("Invalid Input !!!")
  49. except Exception as e:
  50.     print("Wrong Input !!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement