Prompt Title: Student Database Management System.

Created 1 year ago
Votes 0
Views 119 times
IT
0

Prompt Detail:

Sure, here's an example of object-oriented Python code that implements a student database system:

python
class Student: def __init__(self, name, age, gender, grade, address, parent_name, parent_phone): self.name = name self.age = age self.gender = gender self.grade = grade self.address = address self.parent_name = parent_name self.parent_phone = parent_phone self.attendance = {} self.grades = {} self.disciplinary_records = [] def add_attendance(self, date, status): self.attendance[date] = status def add_grade(self, subject, score): self.grades[subject] = score def add_disciplinary_record(self, record): self.disciplinary_records.append(record) class StudentDatabase: def __init__(self): self.students = [] def add_student(self, student): self.students.append(student) def get_student_by_name(self, name): for student in self.students: if student.name == name: return student return None def get_student_by_grade(self, grade): grade_students = [] for student in self.students: if student.grade == grade: grade_students.append(student) return grade_students
avatar
RyanG
Shared 1 prompt
Created 1 year ago

Leave a Comment

Related Tag Prompts

94
0
151
0
Docker Pro
1 year ago 2023-01-29 06:08:59 AIPRM
308
0
MySQL Marvel
1 year ago 2023-02-13 00:05:32 AIPRM
260
0
Ansible Expert
1 year ago 2023-02-01 09:23:50 AIPRM
193
0
PostgreSQL Pro
1 year ago 2023-02-07 03:45:19 AIPRM
114
0
270
1
Dockerize me
1 year ago 2023-02-17 08:27:58 Chad Thompson-Smith