Skip to main content
Welcome to the final stretch. Your dashboard is already functional: it collects mood and energy, accepts goals, and shows results. In this lesson we’ll polish that foundation by focusing on:
  • Improving visual separators and layout
  • Adding today’s date to the header
  • Adding docstrings so future developers (and future you) understand the script
  • Small presentation tweaks (emojis, optional terminal colors)
These are small touches that make the program easier to read, maintain, and extend.

What the current hard-coded layout looks like

Below is an example of a simple, hard-coded header and section separators. It works, but repeating print statements is brittle and harder to maintain.
Why this is problematic
  • Repetition: same separator and header code repeated across files or places.
  • Hard to change: updating the layout requires editing multiple locations.
  • Limited reuse: no small helpers to keep presentation consistent.

Introduce reusable separator functions

Create small helper functions for separators to keep layout consistent and reduce duplication:
These are tiny, explicit, and make it easy to change the look of your dashboard from one place.

Add a date header

Use Python’s datetime utilities to show today’s date in the header. To support different platforms (Windows vs Unix), avoid platform-specific strftime directives like %-d. Use datetime.today().day to get the day without a leading zero:
This produces a header like: DAILY DASHBOARD FOR 18 NOVEMBER, 2025

Greeting function

A small function for a personalized greeting keeps the main flow readable:

Add docstrings and tidy functions

Docstrings are lightweight documentation embedded in your code. They surface in editors and make functions easier to understand. Add a top-level module docstring and brief docstrings for each function.
Add concise docstrings to the top of your file and to functions. They will appear in many editors when you hover over function names and help future maintainers quickly understand intent.

A single, complete, runnable example

Below is a consolidated and cleaned-up dashboard script. It includes docstrings, input validation, reusable separators, a header with today’s date, and small presentation touches like emojis. Note that show_header() uses datetime.today().day to avoid strftime portability issues.

Quick reference — functions and purpose

Sample run (example)

Below is an example terminal session when running the script.

Optional: colored terminal text

If you want colored headings in terminals that support ANSI escape codes:
Remember to reset color with \033[0m.

Input validation summary

Ideas for enhancements

  • Use time of day to change the greeting (morning/evening)
  • Add motivational quotes or a water tracker
  • Persist goals to a file (JSON) so goals survive restarts
  • Add command-line argument parsing for non-interactive runs
  • Turn the dashboard into a small web app with Flask or FastAPI
Take a moment to admire what you built: variables for storing state, if statements for decisions, loops for repetition, lists for collections, and functions to organize everything. This is your dashboard now — customize and expand it as you like.

Watch Video

Practice Lab