0% found this document useful (0 votes)
23 views6 pages

Neha

The document outlines a Python class for managing a Spoken English Classes system, including functionalities for adding students and modules, enrolling students, marking attendance, and viewing records. It features a main menu for user interaction, allowing for various operations related to student and module management. The system maintains lists for students, modules, and attendance records to facilitate these operations.

Uploaded by

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

Neha

The document outlines a Python class for managing a Spoken English Classes system, including functionalities for adding students and modules, enrolling students, marking attendance, and viewing records. It features a main menu for user interaction, allowing for various operations related to student and module management. The system maintains lists for students, modules, and attendance records to facilitate these operations.

Uploaded by

mnahm8096
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

class SpokenEnglishClasses:

def __init__(self):

self.students = [] # List of students

self.modules = [] # List of modules (e.g., Grammar, Vocabulary)

self.attendance = [] # Attendance records (student_id, module_id, date, status)

# Function to add a student

def add_student(self):

name = input("Enter student name: ")

contact = input("Enter student contact: ")

student_id = len(self.students) + 1

self.students.append({'id': student_id, 'name': name, 'contact': contact})

print(f"Student added successfully! Student ID: {student_id}\n")

# Function to add a course module

def add_module(self):

module_name = input("Enter course module name (e.g., Grammar, Vocabulary): ")

module_id = len(self.modules) + 1

self.modules.append({'id': module_id, 'name': module_name})

print(f"Module '{module_name}' added successfully! Module ID: {module_id}\n")

# Function to enroll a student in a module

def enroll_student(self):

if not self.students or not self.modules:

print("Please add students and modules first!\n")

return
student_id = int(input("Enter student ID: "))

module_id = int(input("Enter module ID: "))

student = next((s for s in self.students if s['id'] == student_id), None)

module = next((m for m in self.modules if m['id'] == module_id), None)

if not student or not module:

print("Invalid student or module ID.\n")

return

print(f"{student['name']} has been enrolled in the '{module['name']}' module.\n")

# Function to mark attendance

def mark_attendance(self):

if not self.students or not self.modules:

print("Please add students and modules first!\n")

return

student_id = int(input("Enter student ID: "))

module_id = int(input("Enter module ID: "))

date = input("Enter date (YYYY-MM-DD): ")

status = input("Enter attendance status (Present/Absent): ")

student = next((s for s in self.students if s['id'] == student_id), None)

module = next((m for m in self.modules if m['id'] == module_id), None)


if not student or not module:

print("Invalid student or module ID.\n")

return

self.attendance.append({'student_id': student_id, 'module_id': module_id, 'date': date,


'status': status})

print(f"Attendance for {student['name']} in '{module['name']}' on {date} marked as


{status}.\n")

# Function to view all students

def view_students(self):

if not self.students:

print("No students found.\n")

return

print("\n--- All Students ---")

for student in self.students:

print(f"ID: {student['id']}, Name: {student['name']}, Contact: {student['contact']}")

print()

# Function to view all modules

def view_modules(self):

if not self.modules:

print("No modules found.\n")

return

print("\n--- All Modules ---")

for module in self.modules:


print(f"ID: {module['id']}, Name: {module['name']}")

print()

# Function to view attendance records

def view_attendance(self):

if not self.attendance:

print("No attendance records found.\n")

return

print("\n--- Attendance Records ---")

for record in self.attendance:

student = next(s for s in self.students if s['id'] == record['student_id'])

module = next(m for m in self.modules if m['id'] == record['module_id'])

print(f"Date: {record['date']}, Student: {student['name']}, Module: {module['name']},


Status: {record['status']}")

print()

# Main menu

def main_menu(self):

while True:

print("=== Spoken English Classes Management System ===")

print("1. Add Student")

print("2. Add Module")

print("3. Enroll Student in Module")

print("4. Mark Attendance")

print("5. View Students")

print("6. View Modules")


print("7. View Attendance")

print("8. Exit")

choice = input("Enter your choice: ")

if choice == '1':

self.add_student()

elif choice == '2':

self.add_module()

elif choice == '3':

self.enroll_student()

elif choice == '4':

self.mark_attendance()

elif choice == '5':

self.view_students()

elif choice == '6':

self.view_modules()

elif choice == '7':

self.view_attendance()

elif choice == '8':

print("Exiting... Goodbye!")

break

else:

print("Invalid choice. Please try again.\n")

# Run the system


if __name__ == "__main__":

system = SpokenEnglishClasses()

system.main_menu()

You might also like