Problem: Managing student enrollments manually is time-consuming and prone to errors.
Solution: Automates the process of enrolling students in courses, assigning them to the correct courses, and managing their data.
Benefits: Saves time, reduces human error, and ensures efficient handling of student registrations.
Adoption: This can be expanded to include payment processing, email notifications, and advanced student categorization.
Code:
import csv
# Function to enroll students
def enroll_student(student_name, course_name):
with open('enrollment.csv', mode='a', newline='') as file:
writer = csv.writer(file)
writer.writerow([student_name, course_name])
print(f"{student_name} has been enrolled in {course_name}.")
# Sample student data
students = [
('John Doe', 'Python Programming'),
('Jane Smith', 'Data Science'),
('Alice Brown', 'Machine Learning')
]
# Enroll students
for student in students:
enroll_student(student[0], student[1])
No comments:
Post a Comment