hego code
hego code
import mysql.connector
def connect_to_db():
return mysql.connector.connect(
host="localhost",
db = connect_to_db()
cursor = db.cursor()
cursor.execute("""
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s,
%s, %s, %s,%s,%s)
cursor.close()
db.close()
db = connect_to_db()
cursor = db.cursor()
cursor.execute("INSERT INTO
PROGRESS(user_id,weight,bmi,date)VALUES(%s,%s,%s,%s)",
(user_id,weight,bmi,datetime.now().date()))
db.commit()
cursor.close()
db.close()
all_workouts = {
'Beginner': {
1: ['Bodyweight Exercises'],
},
'Intermediate': {
1: ['Circuit Training'],
},
'Advanced': {
1: ['HIIT'],
2: ['CrossFit', 'HIIT'],
},
'Beginner': {
4: ['HIIT', 'Walking'],
},
'Intermediate': {
2: ['HIIT', 'Swimming'],
},
'Advanced': {
1: ['Plyometrics', 'HIIT'],
},
diet_recipes = {
'Indian': {
},
'Non-Indian': {
},
'Indian': {
},
'Non-Indian': {
},
def display_plans(user_id):
db = connect_to_db()
cursor = db.cursor()
user_data = cursor.fetchone()
cursor.close()
db.close()
if user_data:
fitness_plan = user_data[0]
level = user_data[1]
workout_days_count = int(user_data[2])
nationality = user_data[3]
print("Workout Plans:")
for workout in workouts:
print(f"- {workout}")
print("\nDiet Recipes:")
else:
while True:
print("\nSelect an option:")
print("8.Exit")
print("Select gender:")
print("1. Male")
print("2. Female")
print("3. Other")
print('Yours is underweight')
print('Yours is normal')
print('Yours is overweight')
print('Yours is obesity')
else:
print('Invalid')
print("1. Beginner")
print("2. Intermediate")
print("3. Advanced")
print("Select routine:")
print("1. Cardio")
print("3. Flexibility")
print("1. Vegetarian")
print("2. Non-Vegetarian")
print("Select nationality:")
print("1. Indian")
print("2. Non-Indian")
# Recording progress
record_progress(user_id, weight,bmi,height)
db = connect_to_db()
cursor = db.cursor()
user_data = cursor.fetchone()
cursor.close()
db.close()
if user_data:
fitness_plan = user_data[0]
nationality = user_data[1]
if recipes:
print("\nDiet Recipes:")
else:
else:
display_plans(user_id)
# BMI Calculator
print("Yours is underweight")
print("Yours is normal")
print("Yours is overweight")
else:
print("Yours is obesity")
import random
class ChatBot:
def __init__(self):
self.responses = {
'responses': {
'hi': "Hello! How can I assist you today?",
},
'recipes': {
'tamil_nadu': {
},
'gujarat': {
},
'punjab': {
},
'maharashtra': {
},
'delhi': {
},
'jammu_and_kashmir': {
},
'kerala': {
},
'karnataka': {
},
'general': {
},
'meal_plans': {
'cutting': {
'bulking': {
},
'fat_loss': {
},
'muscle_gain': {
},
},
'workout_plans': {
},
'workout_splits': {
'muscle_gain': {
},
'fat_loss': {
},
'weight_loss': {
},
'yoga': {
'strength_training': {
},
def greet(self):
return random.choice(self.responses['greetings'])
def farewell(self):
return random.choice(self.responses['farewells'])
def thanks(self):
return random.choice(self.responses['thanks'])
def congrats(self):
return random.choice(self.responses['congrats'])
responses = self.responses['responses']
if phrase in user_input:
return response
return None
if diet_type:
else:
meal_plans=self.responses['meal_plans'].get(meal_type, {})
if diet_type:
else:
if split_info:
def start_conversation(self):
while True:
if user_input == 'exit':
print(self.farewell())
break
common_response =
self.respond_to_common_phrases(user_input)
if common_response:
print(f"ChatBot: {common_response}")
if diet_type:
else:
print(f"ChatBot: {self.get_recipes(state)}")
elif 'meal plan' in user_input:
print(f"ChatBot: {self.get_meal_plans(meal_type,
diet_type)}")
else:
print(f"ChatBot: {self.get_meal_plans(meal_type)}")
print(f"ChatBot: {self.get_workout_split(plan_type)}")
else:
if __name__ == "__main__":
chatbot = ChatBot()
chatbot.start_conversation()
class FoodComposition:
def __init__(self):
self.macronutrients = {
'cutting': {
},
'bulking': {
},
'fat_loss': {
},
'muscle_gain': {
},
if gender == 'male':
else:
if activity_level == 'sedentary':
else:
return bmr # Default to BMR if activity level is unknown
return self.macronutrients[goal][age_range]
def start(self):
while True:
if goal == 'exit':
break
continue
try:
print("2. Female")
activity_levels = {
'1': 'sedentary',
'2': 'light',
'3': 'moderate',
'4': 'active',
activity_level = activity_levels.get(activity_choice,
'sedentary')
caloric_needs = self.calculate_caloric_needs(bmr,
activity_level)
composition = self.get_macronutrient_composition(goal,
age)
if isinstance(composition, dict):
print(f"{nutrient}: {amount}")
else:
print(composition)
except ValueError:
if __name__ == "__main__":
food_composition = FoodComposition()
food_composition.start()
1.5star(*****)
2.4star(****)
3.3star(***)
4.2star(**)
5.1star(*)
6.no stars''')
break
else: