Here is a simple way to build a student attendance application with Python:
-
Create a list of students:
students = [
{“name”: “John Doe”, “attendance”: 0},
{“name”: “Jane Doe”, “attendance”: 0},
{“name”: “Bob Smith”, “attendance”: 0}
]
-
Create a function to mark a student present:
def mark_present(student):
student[“attendance”] += 1
-
Create a function to display the attendance for all students:
def display_attendance(students):
for student in students:
print(f”{student[‘name’]}: {student[‘attendance’]}”)
-
Create a main function to run the attendance application:
def main():
while True:
name = input(“Enter the name of the student: “)
for student in students:
if student[“name”] == name:
mark_present(student)
break
display_attendance(students)
if __name__ == “__main__”:
main()
This is a simple example of a student attendance application with Python.
You can expand on this by adding features such as saving and loading the attendance data from a file, keeping track of attendance over multiple days, and adding a graphical user interface.
About Author
Discover more from SURFCLOUD TECHNOLOGY
Subscribe to get the latest posts sent to your email.