Project 24: Emoji Mood Tracker πΒΆ
Difficulty: π’ Beginner
Run cells top to bottom. Each step builds on the previous one and saves real files under outputs/emoji_mood_tracker/.
DescriptionΒΆ
Log daily moods with emojis, score them, and plot a cheerful week-of-feelings chart.
Libraries & ModulesΒΆ
matplotlib.pyplot- Built-in:
datetime
Python Concepts You'll PracticeΒΆ
Dicts as lookups, list aggregations, simple charts
ποΈ Parameter VariationsΒΆ
MOOD_LOGβ swap emoji daysSCORESβ remap how happy each emoji is
InΒ [1]:
# Install dependencies for this project (safe to re-run)
import sys
!{sys.executable} -m pip install pillow numpy matplotlib wordcloud qrcode[pil] python-barcode fpdf2 jinja2 folium plotly pandas scipy ipywidgets -q
Skipping pip install (already installed)
InΒ [2]:
# Interactive Jupyter setup β run this cell first
%matplotlib inline
from pathlib import Path
from IPython.display import display, Image as IPImage, HTML, Markdown, Audio, IFrame
OUTPUT_DIR = Path("outputs") / "emoji_mood_tracker"
OUTPUT_DIR.mkdir(parents=True, exist_ok=True)
print(f"β
Outputs folder: {OUTPUT_DIR.resolve()}")
β Outputs folder: C:\Users\Hansel Yan\Projects\CodeItAll\outputs\emoji_mood_tracker
Step 1 β Score a week of moodsΒΆ
InΒ [3]:
from datetime import date, timedelta
# ποΈ TWEAK THESE
MOOD_LOG = ["π", "π", "π", "π΄", "π€©", "π€", "π₯³"]
SCORES = {"π": 4, "π": 2, "π": 4, "π΄": 1, "π€©": 5, "π€": 1, "π₯³": 5, "π’": 0}
start = date(2026, 7, 6)
days = [start + timedelta(days=i) for i in range(len(MOOD_LOG))]
points = [SCORES.get(m, 2) for m in MOOD_LOG]
avg = sum(points) / len(points)
print(f"Average mood score: {avg:.2f} / 5")
for d, m, p in zip(days, MOOD_LOG, points):
print(f"{d:%a %b %d}: {m} ({p})")
Average mood score: 3.14 / 5 Mon Jul 06: π (4) Tue Jul 07: π (2) Wed Jul 08: π (4) Thu Jul 09: π΄ (1) Fri Jul 10: π€© (5) Sat Jul 11: π€ (1) Sun Jul 12: π₯³ (5)
Step 2 β Draw the mood lineΒΆ
InΒ [4]:
import matplotlib.pyplot as plt
labels = [d.strftime("%a") for d in days]
fig, ax = plt.subplots(figsize=(8, 4))
ax.plot(labels, points, marker="o", linewidth=2.5, color="#111111")
ax.fill_between(labels, points, alpha=0.12, color="#8b1e1e")
ax.set_ylim(0, 5.5)
ax.set_title("Emoji Mood Tracker β CodeItAll")
ax.set_ylabel("Mood score")
fig.tight_layout()
out = OUTPUT_DIR / "mood_tracker.png"
fig.savefig(out, dpi=140)
plt.show()
(OUTPUT_DIR / "mood_log.txt").write_text(
"\n".join(f"{d}|{m}|{p}" for d, m, p in zip(days, MOOD_LOG, points)),
encoding="utf-8",
)
print(f"Saved {out}")
Saved outputs\emoji_mood_tracker\mood_tracker.png
β Project completeΒΆ
Check your output folder: outputs/emoji_mood_tracker/
Next: Project 25: Unit Converter Booth Β· Index