Python Project for health management system.
Python Health Management System |
This project is used for docotor or gym fitness trainer.in this project we get input from client to his name diet,excercise. First we get input client name and his diet and food. All this client information record securly in file using date and time also
import datetime
while True:
def getdate():
return datetime.datetime.now()
try:
user_log = int(input("press 1 for samir 2 for dahal and 3 for hanu"))
user_profile = int(input("press for 1 write and press 2 for read"))
user_activites = int(input("press 1 for excercise and press 2 for food"))
if user_log ==1:
print("samir")
if user_activites == 1:
print("you do excersise")
if user_profile==1:
print("write your excersise ")
sameer = input()
with open("samirexcersise.txt","a")as f:
f.write(sameer)
f.write("\n")
else:
print("read your file")
with open("samirexcersise.txt","r")as f:
content = f.read()
print(content)
else:
if user_activites == 2:
print(" you eat food")
if user_profile ==1:
with open ("samirfood.txt","a")as f :
print(("Write food"))
sameer = input()
f.write(sameer)
f.write("\n")
else:
print("read your file")
with open("samirfood.txt","r")as f:
content = f.read()
print(content)
elif user_log==2:
print("dahal")
if user_activites==1:
print("you do excercise")
if user_profile == 1:
print("write your excersise")
dahal = input()
with open("dahalexcersie.txt","w")as f:
f.write((dahal))
f.write("\n")
else:
with open("dahalexcersie.txt","r")as f:
content = f.read()
print(content)
else:
if user_activites==2:
print("you eat food")
if user_profile==1:
print("you write a food")
dahal = input()
with open("dahalfood.txt","a")as f:
f.write(dahal)
f.write("\n")
else:
with open("dahalfood.txt","r")as f:
content = f.read()
print(content)
elif user_log==3:
print("hanu")
if user_activites ==1 :
print("you do excersise")
if user_profile==1:
hanu = input()
with open("hanuexcersise.txt","a")as f:
f.write(hanu)
f.write("\n")
else:
with open("hanuexcersise.txt","r")as f:
content = f.read()
print(content)
else:
if user_activites==2:
print("you eat food")
if user_profile == 1:
hanu = input()
with open("hanufood.txt","a")as f:
f.write(hanu)
f.write("\n")
else:
with open("hanufood.txt","r")as f:
content = f.read()
print(content)
print("press q for exit and contunie for any key")
a = input()
if a =="q":
break
except:
print("you input a wrong numder or cannot find personal file")
Describe the python project for intermidiate HML
HML stand for Health Managenment System. At first we import datetime to track the user diet and excersise. Use a def fuction to return the date and time.
Get user input what do you want like read or write your excersise and diet. Check our condition which condition is meet.
If the write condition meet of exersise than user get input of his excersise or meet his food user get write his diet.
When user want to see which datae and time which diet his taken and which excersise his perform in gym that all avialable in this program.
We use file open system to write his food and excersie and also use to read when client want to read his food and excersie information.
Try and except is the error handling in python if user input any invalid option in our program that print invalid input. It is save for a program crash.
Describe Error handling in python.
try:
#this programme is written by code bug free
a = int(input("enter a number: "))
divide = 1/a
print(divide)
except ValueError as e:
print("yo enter a alphabet.Alphabet cammot divide number")
except Exception as e:
e = "there is invalid input"
print(e)
except ZeroDivisionError as e:
print("it is not division by 0")
except:
print("you make some things wrong in some program")
print("thanks for use us")
First we use input from user and convert string into integers. that integers divided by 0. If input number is not divisiable by 0 than print ZERODIVISIABLYERROR. If user input any string means alphabet> Alphabet cannot divide by integers so there is print VALUEERROR. Other cases of error there is print there is invalid and you make some things wrong in some program. ther is many error to handling such as value error, zero divisable erroer, syntax error, name error, type error, run time error. etc.
0 Comments
Don't comment a spam message