Back to projects
PythonBeginner45–60 minutes
Student Attendance Tracker
A simple classroom-style program that works entirely on one laptop. Students practice lists, loops, conditions, and basic data handling without needing a database or internet connection.
Starter code
Read it. Run it. Change it.
Save the code below as attendance_tracker.py. The example is intentionally small enough for a student to explain line by line before adding new features.
attendance_tracker.pyPython
students = ["Aarav", "Riya", "Kabir", "Meera"]
present = []
absent = []
for student in students:
answer = input(f"Is {student} present? (yes/no): ").lower()
if answer == "yes":
present.append(student)
else:
absent.append(student)
print("\nPresent students:", present)
print("Absent students:", absent)
print("Total present:", len(present))
print("Total absent:", len(absent))How to run it on a laptop
- 1. Install Python 3 if it is not already available.
- 2. Open IDLE, Thonny, VS Code, or any simple text editor.
- 3. Copy the code into a new file named
attendance_tracker.py. - 4. Run the file. No internet connection, database, or server is required.
Build it step by step
1
Create the class list
Store student names inside a Python list.
2
Ask about each student
Use a loop so the same question can be repeated automatically.
3
Sort the answers
Add names to present or absent lists based on the response.
4
Show the result
Print the names and totals at the end.
Make it your own
- Let the user type the student names before attendance begins.
- Calculate the percentage of students present.
- Save the final attendance as a text file after learning file handling.