DAV PUBLIC SCHOOL CHANDRASEKHARPUR,
BHUBANESWAR, ODISHA - 751021
COMPUTER SCIENCE PROJECT
ON
Student Record Management
(USING PYTHON)
NAME: PRATYUSH BISWAL
CLASS : XII
SEC:C
BOARD ROLL NO:
DECLARATION
I Pratyush Biswal of class XII sec C bearing Board Roll
No. _______________of DAV Public School,
Chandrasekharpur, Bhubaneswar, Odisha hereby
submit the project entitled “Student Record
Management” towards the partial fulfillment of the
requirement of AISSCE 2023-24 Practical Examination
in the subject Computer Science (083).
This project consists of original work done by me under
the guidance and supervision of our Computer Science
teacher, Mrs. Rasmita Ghadai.
____________
𝑆𝑆𝑆𝑆udent’s Signature
ACKNOWLEDGMENT
I would like to express a profound sense of gratitude to
our guide Mrs. Rasmita Ghadai(PGT Computer Science)
for her valuable guidance and suggestion during the
preparation of my project work.
With great pleasure, I also extend my gratitude to my
parents for their support and laboratory assistant for
his help which enabled me to complete this piece of
work successfully.
___________
𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆𝑆′𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠.
CERTIFICATE
This is to certify that the Project titled “Student
Record Management ” is an original piece of work
done by PRATYUSH BISWAL of class XII sec C bearing
Board Roll No. ________ is in accordance with the topic
allotted to them.
This project is submitted towards the partial fulfillment
of the of the condition laid down for Class XII AISSCE
2023-24 and embodies the work done by them under
my guidance and supervision.
𝑇𝑇𝑇𝑇𝑇𝑇𝑇𝑇ℎ𝑒𝑒𝑒𝑒′𝑠𝑠 𝑠𝑠𝑠𝑠𝑠𝑠𝑠𝑠.
Introduction and System Requirements
Explanation of the Code:
1. Classes:
Student: This class represents a student with
•
attributes for name, roll number, and marks. It
has a __str__ method to format the output
when printing.
• StudentRecordManager: This class
handles all operations related to student
records, including loading, saving, adding,
searching, updating, deleting, and displaying
records.
2. File Handling: The application uses a text
file (student_records.txt) to store student records.
Each record is stored in a comma-separated
format.
3. Methods:
• load_records(): Loads records from the text
file and returns them as a list
of Student objects.
• save_records(records): Saves the list
of Student objects back to the text
file.
• add_record(): Prompts the user to
input a new student record and
appends it to the list.
• search_record(): Searches for a
student record by roll number and
displays it if found.
• update_record(): Updates an existing
student record based on user input.
SOURCE CODE
import os
class Student:
def __init__(self, name, roll_number, marks):
self.name = name
self.roll_number = roll_number
self.marks = marks
def __str__(self):
return f"{self.name},{self.roll_number},{self.marks}"
class StudentRecordManager:
FILENAME = 'student_records.txt'
def load_records(self):
records = []
if os.path.exists(self.FILENAME):
with open(self.FILENAME, 'r') as file:
for line in file:
name, roll_number, marks = line.strip().split(',')
records.append(Student(name, roll_number, marks))
return records
def save_records(self, records):
with open(self.FILENAME, 'w') as file:
for record in records:
file.write(str(record) + '\n')
def add_record(self):
name = input("Enter student name: ")
roll_number = input("Enter roll number: ")
marks = input("Enter marks: ")
student = Student(name, roll_number, marks)
records = self.load_records()
records.append(student)
self.save_records(records)
print("Record added successfully!")
def search_record(self):
roll_number = input("Enter the roll number to search: ")
records = self.load_records()
for record in records:
if record.roll_number == roll_number:
print(f"Record found: {record}")
return record
print("Record not found.")
return None
def update_record(self):
record = self.search_record()
if record:
new_name = input("Enter new name (leave blank to keep current):
")
new_marks = input("Enter new marks (leave blank to keep current):
")
if new_name:
record.name = new_name
if new_marks:
record.marks = new_marks
records = self.load_records()
self.save_records(records)
print("Record updated successfully!")
def delete_record(self):
record = self.search_record()
if record:
records = self.load_records()
records.remove(record)
self.save_records(records)
print("Record deleted successfully!")
def display_records(self):
records = self.load_records()
if records:
print("Student Records:")
for record in records:
print(record)
else:
print("No records found.")
def main_menu():
manager = StudentRecordManager()
while True:
print("\nStudent Record Management System")
print("1. Add Record")
print("2. Search Record")
print("3. Update Record")
print("4. Delete Record")
print("5. Display All Records")
print("6. Exit")
choice = input("Choose an option: ")
if choice == '1':
manager.add_record()
elif choice == '2':
manager.search_record()
elif choice == '3':
manager.update_record()
elif choice == '4':
manager.delete_record()
elif choice == '5':
manager.display_records()
elif choice == '6':
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")
if __name__ == "__main__":
main_menu()
OUTPUT
Student Record Management System
1. Add Record
2. Search Record
3. Update Record
4. Delete Record
5. Display All Records
6. Exit
Choose an option:
ADDING A RECORD
Enter student name: John Doe
Enter roll number: 101
Enter marks: 85
#Record added successfully!
Displaying All Records
Student Records:
John Doe,101,85
#Enter the roll number to search: 101
Updating a Record
Enter the roll number to search: 101
Enter new name (leave blank to keep current): John Smith
Enter new marks (leave blank to keep current): 90
#Record updated successfully!
THANK
YOU