Project: Personal Habit Tracker
Explore how to build a personal habit tracker app using Python that lets you add habits, check them off daily, and view progress. Learn to manage data with lists or dictionaries and use loops and conditional statements for updates. Enhance your coding skills with a practical project that motivates habit formation and introduces optional data saving features.
Let’s build something useful and fun! Your personal habit tracker will help you record daily habits, visualize your progress, and stay motivated.
In this project, you’ll create an app where users add habits, mark them complete, and track their streaks and stats.
Goals
You’ll aim to
Create and manage habits using Python lists or dictionaries.
Use loops and conditionals to update and view progress.
Optional: Save and load data using files.
Project steps
Step 1: Set up your habits
Start by creating a welcoming interface (a welcome message and a list to store habits).
# Write your code here.
Step 2: Add habits
Allow the user to add their own habits.
print("📝 Welcome to your Personal Habit Tracker!")
habits = []
# Write your code here.Step 3: Daily check-in
Provide a fun way to check off habits each day.
print("📝 Welcome to your Personal Habit Tracker!")
habits = []
while True:
habit = input("Enter a habit to track (or type 'done' when finished): ")
if habit.lower() == 'done':
break
habits.append({'habit': habit, 'completed': 0})
# Write your code here.Step 4: View progress
Summarize progress to encourage ongoing motivation.
print("📝 Welcome to your Personal Habit Tracker!")
habits = []
while True:
habit = input("Enter a habit to track (or type 'done' when finished): ")
if habit.lower() == 'done':
break
habits.append({'habit': habit, 'completed': 0})
for habit in habits:
done = input(f"Did you complete '{habit['habit']}' today? (yes/no): ")
if done.lower() == 'yes':
habit['completed'] += 1
print("Great job! Keep up the streak! 🔥")
else:
print("No worries! Tomorrow is another chance! 🌤️")
# Add your code here.Project tips
Keep feedback positive and encouraging.
Consider visual elements (like emojis) to add personality.
Use clear and intuitive prompts.
Mini challenge
Add a feature to reset streaks after missing multiple days.
Implement a simple system for rewarding consistent completion.
print("📝 Welcome to your Personal Habit Tracker!")
habits = []
while True:
habit = input("Enter a habit to track (or type 'done' when finished): ")
if habit.lower() == 'done':
break
habits.append({'habit': habit, 'completed': 0})
for habit in habits:
done = input(f"Did you complete '{habit['habit']}' today? (yes/no): ")
if done.lower() == 'yes':
habit['completed'] += 1
print("Great job! Keep up the streak! 🔥")
else:
print("No worries! Tomorrow is another chance! 🌤️")
print("\n📅 Your Habit Progress:")
for habit in habits:
print(f"{habit['habit']}: Completed {habit['completed']} times")
# Add your code here.
If you’re stuck, click the “Show Solution” button.
Go further
Save and load progress from a file to track long-term habits.
Create weekly or monthly summaries and reports.
Great! Your personal habit tracker is ready to help build great habits and keep motivation high. Happy tracking!
What’s next?
In the next chapter, we’ll move forward in Python by learning how to use AI as a practical coding partner, not to replace your thinking, but to speed up your progress, and raise the bar of things you can build. We’ll quickly go through prompt writing, then use those prompts to generate real code and build a capstone budget tracker app step by step, even if you’re starting from zero.