Title: Building a 3-in-1 Smart Clock CLI App in Python (Time, Alarm & Stopwatch)
After taking a rest day to avoid burnout, I jumped back into my daily 20–30 minute coding routine by building a practical, non-game utility: a 3-in-1 Smart Clock CLI App in Python using time and datetime.
🛠️ What It Does
-
Current Time: Formats live system time into a clean 12-hour clock (
%I:%M:%S). -
Alarm / Timer: Runs a 1-second polling loop (
time.sleep(1)) that matches user input against live time and rings 5 times before returning to the main menu. -
Stopwatch: Counts elapsed seconds in real time until interrupted via
Ctrl + C.
🐛 Bugs I Fixed & Known Drawbacks
-
What I Fixed: In my early drafts, I accidentally placed the alarm
input()inside thewhile Truepolling loop (causing it to ask for the time every second) and tried incrementing astrftimestring instead of an integer counter for the stopwatch. -
Known Drawbacks: Because I kept this version pure without
try-exceptor multithreading, the alarm loop blocks the menu while waiting, and stopping the stopwatch viaCtrl + Cexits the entire script.
⚖️ Honest Work Split (70% Me / 30% AI)
- 70% Me: Designing the menu dictionary, writing every line in VS Code, setting up the 5-cycle alarm loop, and structuring the stopwatch logic.
-
30% AI Mentorship: Helping me debug
strftimesyntax differences betweentimeanddatetimeand spotting loop-exitbreakplacements.
repo link to get the code source[https://github.com/MANAN-FULLSTACK-DEV/PYTHON-BASICS-PRACTICE-AND-LEARNING/blob/main/3-in-1%20clock.py]
What small CLI utility tools did you build when learning Python's datetime module? Let me know in the comments! 👇
Top comments (0)