🚀 Overview The Daily Calorie Tracker is a simple Python program designed to help users log and monitor their daily calorie intake. It calculates the total and average calories consumed, compares the total to a user-defined daily limit, and provides a summary of all meals. Additionally, the program offers the option to save the daily log—including the date, time, meal details, and final status—into a text file named calorie_log.txt for future reference.
Meal Input: Easily enter the name and calorie count for each meal.
Total and Average Calculation: Automatically computes the total and average calories consumed for the day.
Limit Check: Compares the total calories against a user-specified daily limit and reports the status.
Meal Summary Table: Displays a clear, in-terminal summary of all entered meals, total calories, and average calories.
Data Logging: Option to save the log to a text file (calorie_log.txt) with a timestamp, allowing users to track their progress over time.
Save the Code: Save the provided Python code as a file named tracker_calories.py.
Open Terminal: Open your command line or terminal.
Navigate: Change the directory to where you saved the file.
Execute: Run the script using the Python interpreter: python tracker_calories.py
Example Usage When you run the script, you will see prompts similar to this:
Welcome to Daily Calorie Tracker
How many meals did you have today? 3 Enter meal name: Breakfast Enter calories for Breakfast: 450 Enter meal name: Lunch Enter calories for Lunch: 620 Enter meal name: Dinner Enter calories for Dinner: 500
Enter your daily calorie limit: 1400
Meal Summary:
Meal Calories Breakfast 450.0 Lunch 620.0 Dinner 500.0 Total 1570.0 Average 523.3333333333334
You ate more than your daily limit
Do you want to save your log? (yes/no): yes
Your log has been saved successfully in calorie_log.txt file.
Thank you for using the Daily Calorie Tracker! If you choose to save the log, a file named calorie_log.txt will be created (or appended to) with a log that looks like this:
------ DAILY CALORIE LOG ------ Log Date: 15-10-2025 | 11:59 AM
Meal Calories Breakfast 450.0 Lunch 620.0 Dinner 500.0
Total 1570.0 Average 523.3333333333334 Limit 1400.0 Status Limit Exceeded
🛠️ Dependencies This program uses the following standard Python modules:
datetime: Used to generate the current date and time for the saved log.
No external libraries need to be installed.
👤 Author Name: Shivangi
Date: 15-10-2025