Problem: Tracking student attendance manually is inefficient and error-prone.
Solution: Automates the tracking of student attendance for each class session.
Benefits: Saves time, provides accurate attendance records, and can generate reports.
Adoption: This system can be expanded with features like email reminders and integration with school management systems.
Code:
import csv
from datetime import datetime
# Function to mark attendance
def mark_attendance(student_name, course_name, status):
with open('attendance.csv', mode='a', newline='') as file:
writer = csv.writer(file)
writer.writerow([student_name, course_name, status, datetime.now()])
print(f"Attendance marked for {student_name} in {course_name}.")
# Sample student attendance
attendance_data = [
('John Doe', 'Python Programming', 'Present'),
('Jane Smith', 'Data Science', 'Absent'),
('Alice Brown', 'Machine Learning', 'Present')
]
# Mark attendance
for record in attendance_data:
mark_attendance(record[0], record[1], record[2])
No comments:
Post a Comment