Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
chatbot/project.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
67 lines (62 sloc)
2.59 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
print("HELlO! I'm your personal calorie tracker . lets get started but i'll need some information from you first.") | |
naU=input("what is your name?") | |
g=input("what do you like to be called? choose: 1. Male 2.Female") | |
if g=="1" : | |
a= input("please enter your age.") | |
c1=6.3 | |
c2=12.2 | |
c3=6.8 | |
else: | |
a= input("please enter your age.Its okay to reveal your true age.. I wont tell anyone.") | |
c1=4.3 | |
c2=4.7 | |
c3=4.7 | |
system=input("which measurement system do you prefer? PRESS 1 for imperial or 2 metric ? I love the metric system but its your choice anyways.") | |
if system=="1": | |
w= input(str(naU)+", whats your current body weight?") | |
h= input("and your height please?") | |
w1=0.454*float(w) | |
h1=0.305*float(h) | |
else: | |
w= input(str(naU)+", whats your current body weight?") | |
h= input("and your height please?") | |
w1=float(w) | |
h1=float(h) | |
a1=int(a) | |
bmi= w1/(h1**h1) | |
if bmi>25: | |
print("Looks like you have put on some extraa weight. NO need to worry . Im here to help you cut your calorie intake." ) | |
elif bmi<18.5: | |
print("Looks like you need to put on some weight. NO need to worry. Im here to help you take those extra calories to gain some muscles.") | |
else: | |
print("Seems like you are on the right track to a healthy body. let me help you track your calorie intake so you can stay fit.") | |
bmr=66+(c1*w1*2.20)+(c2*h1*39.4)-(c3*a1) | |
daWater=round(w1*0.033,1) | |
l= input("How active are you? Choose one number from below" +"\n" + "1.sedentary(little or no exercise)" +"\n"+"2.moderately active"+"\n"+"3.very active") | |
if l==1 : | |
calrq= bmr*1.2 | |
elif l==2: | |
calrq=bmr*1.375 | |
else: | |
calrq=bmr*1.55 | |
calrqi=int(calrq) | |
slHR=input("How many hours do you usually sleep in a day?") | |
tiIN=(((daWater*1000)/250)/(24-int(slHR))) *60 | |
tiInI=int(tiIN) | |
print("According to the information provided by you , your daily calory intake should be " + str(calrqi)) | |
print("and you need to drink atleast "+ str(daWater)+"l water everday. So, dont forget to drink 1 glass of water every"+str(tiInI)+" mins when you are not sleeping. Drink extra if you can ;)") | |
api_key = "&app_key=f397fdb230f67a1677d0a99b90921a3e" | |
app_id = "&app_id=c849a705" | |
base_url = "https://api.edamam.com/api/food-database/parser?ingr=" | |
request_input = "" | |
user_input = input(">>") | |
for i in user_input: | |
if i != " ": | |
request_input=request_input+i | |
else: | |
request_input=request_input+"%20" | |
api_call = base_url + request_input + api_key + app_id | |
req = requests.get(api_call).json () | |
kcal = req ['parsed'][0] | |
print (kcal) |