0% found this document useful (0 votes)
11 views12 pages

Student Record Management Program Guide

Uploaded by

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

Student Record Management Program Guide

Uploaded by

cvt3zuuuyi
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Carmel Convent Senior Secondary

School
Phalka Bazar, Lashkar, Gwalior, Madhya Pradesh -474001

ALL INDIA SENIOR CERTIFICATE


EXAMINATION
(AISSCE)

Computer Science PROJECT


2024-2025
XII- Science (BIO)

1
Student Record Management Program - User
Manual
Introduction

The Student Record Management Program is a simple console-based


application that allows you to manage student records. The program allows
you to:

● Add new student records


● View all student records
● Search and update student marks
● Delete student records

The data is stored in a binary file ([Link]), and it uses Python's


pickle module for data serialization and deserialization.

Features

1. Write Initial Data: Add multiple student records to the file.


2. Add New Student: Add a single new student record to the file.
3. View All Students: View the details of all students stored in the file.
4. Search and Update Marks: Search for a student by their roll number
and update their marks.
5. Delete Student Record: Delete a student record by their roll number.

2
import pickle
filename = "[Link]"
# Initialize the file by taking user input
def write_initial_data():
students = [] # List to hold student
details
n = int(input("Enter the number of students
to add: "))
for _ in range(n):
roll = int(input("Enter Roll Number:
"))
name = input("Enter Name: ")
dob = input("Enter Date of Birth
(DD-MM-YYYY): ")
father_name = input("Enter Father's
Name: ")
stream = input("Enter Stream (e.g.,
Science, Commerce, Arts): ")
marks = float(input("Enter Marks (out
of 100): "))
[Link]({"roll": roll, "name":
name, "dob": dob, "father_name": father_name,
"stream": stream, "marks": marks})

3
with open(filename, "wb") as file:
[Link](students, file)
print("Data written to file successfully!")

# Load data from the binary file


def load_data():
try:
with open(filename, "rb") as file:
return [Link](file)
except FileNotFoundError:
print("Error: The file does not exist.
Please write data first.")
return [] # Return an empty list if
the file is not found
except EOFError:
print("Error: The file is empty or has
no valid data.")
return []
# Save data back to the binary file
def save_data(students):
with open(filename, "wb") as file:
[Link](students, file)

4
# Add a new student
def add_student():
roll = int(input("Enter Roll Number: "))
name = input("Enter Name: ")
dob = input("Enter Date of Birth
(DD-MM-YYYY): ")
father_name = input("Enter Father's Name:
")
stream = input("Enter Stream (e.g.,
Science, Commerce, Arts): ")
marks = float(input("Enter Marks (out of
100): "))

students = load_data()

# Check for duplicate roll number


for student in students:
if student["roll"] == roll:
print("Error: Roll number already
exists!")
return

[Link]({"roll": roll, "name":


name, "dob": dob, "father_name": father_name,
"stream": stream, "marks": marks})
save_data(students)
print("Student added successfully!")

5
# View all student records
def view_students():
students = load_data()
if not students:
print("No records found!")
return

print("\nStudent Records:")
for student in students:
print("Roll:", student["roll"], ",
Name:", student["name"], ", DOB:",
student["dob"],
", Father's Name:",
student["father_name"], ", Stream:",
student["stream"], ", Marks:",
student["marks"])

6
# Search and update student details
def search_and_update():
roll = int(input("Enter Roll Number to
search: "))
students = load_data()
for student in students:
if student["roll"] == roll:
print("Found: Roll:",
student["roll"], ", Name:", student["name"], ",
DOB:", student["dob"],
", Father's Name:",
student["father_name"], ", Stream:",
student["stream"], ", Marks:",
student["marks"])

update_choice = input("Do you want


to update marks? (yes/no): ").lower()
if update_choice == "yes":
new_marks = float(input("Enter
new marks: "))
student["marks"] = new_marks
save_data(students)
print("Marks updated
successfully!")
return

print("Roll number not found!")

7
# Delete a student record
def delete_student():
roll = int(input("Enter Roll Number to
delete: "))
students = load_data()

updated_students = [] # This will store


the students to be kept
for student in students:
if student["roll"] != roll: # Only add
the students who do not match the roll number
updated_students.append(student)

if len(updated_students) == len(students):
print("Roll number not found!")
return

save_data(updated_students)
print("Student deleted successfully!")

8
# Menu-driven program
def menu():
while True:
print("\nStudent Record Management")
print("1. Write Initial Data to File")
print("2. Add New Student")
print("3. View All Students")
print("4. Search and Update Marks")
print("5. Delete Student Record")
print("6. Exit")
choice = int(input("Enter ur choice:"))
if choice == 1:
write_initial_data()
elif choice == 2:
add_student()
elif choice == 3:
view_students()
elif choice == 4:
search_and_update()
elif choice == 5:
delete_student()
elif choice == 6:
print("Exiting the program.")
break
else:
print("Invalid choice!")
# Run the program
menu()

9
O/p

1. Writing data to the file

2. Adding new Student

10
3. Viewing data

4. Searching and updating marks

5. Deleting record

* Viewing again

6. Exiting

11
THANK YOU

12

Common questions

Powered by AI

The program ensures robustness by incorporating error checking, such as verifying file existence and non-invalid data before loading . Moreover, it checks for duplicate roll numbers when adding students and invalid inputs during menu selection, providing clear user feedback. These measures minimize crashes and allow users to correct inputs or load initial data if necessary, facilitating smooth recovery from typical user errors .

The significance of removing a student record by roll number is to maintain an up-to-date and accurate database. The program ensures accurate deletion by iterating through the list of students and creating a new list excluding the student with the specified roll number. If no record matches the roll number, it prints a message stating it wasn't found. This precise selection and reconstruction method ensures that only the intended record is removed .

The Student Record Management Program provides several key functionalities to manage student records efficiently. These include adding new student records, viewing all student records, searching and updating student marks, and deleting student records. These functions facilitate management by allowing users to store data in a binary file using Python's pickle module for easy data serialization and deserialization, ensuring data integrity and ease of access .

The program ensures data integrity by checking for duplicate roll numbers before adding a new student. When a user attempts to add a student, the program loads existing data from the file and verifies if the roll number already exists. If it does, the program returns an error message and aborts the addition to prevent duplicates, thereby maintaining data integrity .

To update a student's marks, the program allows users to search for a student using their roll number. Once found, it provides an option to update the marks. If the user chooses to update, the program prompts for the new marks, updates the record in memory, and then writes the updated data back to the file, ensuring the changes are saved permanently. This process prevents accidental overwriting or data loss .

The pickle module is used in the Student Record Management Program for data serialization and deserialization of student records into a binary file format. It is preferred because it provides a simple way of converting Python objects into a byte stream, allowing for easy read and write operations on objects rather than plain text, which enhances the security and integrity of sensitive data such as student records .

If file not found or empty file errors were not handled correctly, the program could crash or behave unpredictably, resulting in a poor user experience and potential data loss. Users might attempt to access non-existing data or introduce errors if the program does not guide them correctly. Effective error handling prevents these issues by informing users to write initial data and maintains program stability for ongoing operations .

A menu-driven user interface offers several advantages, including ease of use and navigability. It presents users with clear options, allowing them to perform tasks such as adding, viewing, or deleting student records, and updating marks by selecting corresponding menu items. This structured approach makes the program intuitive and reduces user errors by guiding them through each function step-by-step .

The error-handling mechanisms in the program address situations where the binary file might not exist or contain invalid data. The program uses try-except blocks to catch FileNotFoundError if the file isn't found and EOFError if the file is empty or has no valid data. In such cases, it prints an error message and returns an empty list, ensuring the program can continue running without crashing .

Viewing all students' records is important for providing a comprehensive overview of the stored data, allowing educators and administrators to assess information quickly such as performance trends by reviewing marks and other personal details. This aids in data management by facilitating decision-making processes based on complete and current student data, ensuring all actions taken reflect the students' most recent records .

You might also like