0% found this document useful (0 votes)
2 views19 pages

Daily Learning & Focus Tracker in Python

The document outlines a Python-based Daily Learning & Focus Tracker application designed for students to monitor their study habits, time spent on subjects, and focus levels, utilizing both MySQL and CSV for data storage. Key features include adding records, calculating total time spent on subjects, and analyzing focus levels through a simple menu-driven interface. The project demonstrates practical applications of Python connectivity and file handling, aimed at fostering disciplined learning habits.

Uploaded by

kalev7128
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views19 pages

Daily Learning & Focus Tracker in Python

The document outlines a Python-based Daily Learning & Focus Tracker application designed for students to monitor their study habits, time spent on subjects, and focus levels, utilizing both MySQL and CSV for data storage. Key features include adding records, calculating total time spent on subjects, and analyzing focus levels through a simple menu-driven interface. The project demonstrates practical applications of Python connectivity and file handling, aimed at fostering disciplined learning habits.

Uploaded by

kalev7128
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

SOURCE CODE (CONNECTIVITY)

import [Link]

con = [Link](
host="localhost",
user="root",
password="root",
database="learning"
)

cur = [Link]()
[Link]("create table if not exists records(subject varchar(30), time integer, focus integer)")
MAIN CODE
def add_entry():
subject = input("Enter Subject Name: ")
time_spent = int(input("Enter Time Spent: "))
focus = int(input("Enter Focus Level: "))
q = "insert into records values(%s,%s,%s)"
[Link](q,(subject,time_spent,focus))
[Link]()
print("Entry Added Successfully")
MAIN CODE (CONTINUED)
def total_time():
[Link]("select subject, sum(time) from records group by subject")
for r in [Link]():
print(r)
MAIN CODE (MENU)
while True:
print("1. Add Entry")
print("2. Total Time")
print("3. Exit")
ch = int(input("Enter choice: "))
if ch == 1:
add_entry()
elif ch == 2:
total_time()
elif ch == 3:
break
OUTPUT
Enter Subject Name: Physics
Enter Time Spent: 60
Enter Focus Level: 8
Entry Added Successfully

('Physics', 60)
KENDRIYA VIDYALAYA SANGATHAN
DAILY LEARNING & FOCUS TRACKER
Python – Connectivity Version
Class XII – Computer Science
Academic Year 2025–26
INTRODUCTION
The Daily Learning & Focus Tracker is a Python-based application designed to
help students monitor daily study habits, time spent on subjects, and focus levels.
This upgraded version uses file connectivity for permanent storage of data.
FLOW OF CONTROL
User selects option from menu → Function executes → Data stored in CSV file →
Time calculated → Low focus identified → Program exits
FEATURES OF THE PROJECT
• Add daily learning records
• Permanent data storage
• Subject-wise total time calculation
• Focus level analysis
• Simple menu-driven interface
TOOLS & TECHNOLOGIES USED
• Python 3.x
• CSV File Handling
• Functions & Loops
• IDE (IDLE / VS Code)
SYSTEM REQUIREMENTS
Hardware:
• Minimum 2 GB RAM

Software:
• Python Installed
SOURCE CODE (CONNECTIVITY)
import csv

FILE = "[Link]"

def init_file():
try:
with open(FILE, "x", newline="") as f:
writer = [Link](f)
[Link](["Subject","Time","Focus"])
except:
pass

init_file()
SOURCE CODE (CONTINUED)
def read_all():
with open(FILE,"r") as f:
reader = [Link](f)
for row in reader:
print(row)
MAIN CODE
def add_entry():
subject = input("Enter Subject Name: ")
time_spent = int(input("Enter Time Spent: "))
focus = int(input("Enter Focus Level: "))
with open(FILE,"a",newline="") as f:
writer = [Link](f)
[Link]([subject,time_spent,focus])
MAIN CODE (CONTINUED)
def total_time():
subject_time = {}
with open(FILE,"r") as f:
reader = [Link](f)
next(reader)
for r in reader:
subject_time[r[0]] = subject_time.get(r[0],0) + int(r[1])
for s in subject_time:
print(s,subject_time[s])
MAIN CODE (CONTINUED)
while True:
print("1. Add Entry")
print("2. Total Time")
print("3. Low Focus")
print("4. Exit")
ch = int(input("Enter choice: "))
if ch == 1:
add_entry()
elif ch == 2:
total_time()
elif ch == 3:
low_focus()
elif ch == 4:
break
OUTPUT
Enter Subject Name: Physics
Enter Time Spent: 60
Enter Focus Level: 8
Entry Added Successfully
CONCLUSION
This project demonstrates the practical use of Python connectivity and file
handling. It helps students develop disciplined learning habits and understand
real-life applications of programming.
BIBLIOGRAPHY
• NCERT Computer Science Class XII
• Python Documentation ([Link])

You might also like