TABLE OF CONTENT
ABOUT PYTHON 1-3
HARDWARE AND SOFTWARE 4
REQUIREMENTS
ABOUT THIS PROJECT 5-6
SOURCE CODE 7-13
OUTPUT 14-
16
FUTURE ENHANCEMENTS 17-
19
THANK YOU 20
ABOUT PYTHON
Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics developed by Guido van Rossum. It was
originally released in 1991. Designed to be easy as well as fun, the name
"Python" is a nod to the British comedy group Monty Python. Python has
a reputation as a beginner-friendly language, replacing Java as the most
widely used introductory language because it handles much of the
complexity for the user, allowing beginners to focus on fully grasping
programming concepts rather than minute details.
Python is used for server-side web development, software development,
mathematics, and system scripting, and is popular for Rapid Application
Development and as a scripting or glue language to tie existing
components because of its high-level, built-in data structures, dynamic
typing, and dynamic binding. Program maintenance costs are reduced
with Python due to the easily learned syntax and emphasis on readability.
Additionally, Python's support of modules and packages facilitates
modular programs and reuse of code. Python is an open-source
community language, so numerous independent programmers are
continually building libraries and functionality for it.
Python Use Cases
Creating web applications on a server
Building workflows that can be used in conjunction with software
Connecting to database systems
Reading and modifying files
Performing complex mathematics
Processing big data
Fast prototyping
Developing production-ready software
Professionally, Python is great for backend web development, data
analysis, artificial intelligence, and scientific computing. Developers also
use Python to build productivity tools, games, and desktop apps.
Features and Benefits of Python
Compatible with a variety of platforms including Windows, Mac,
Linux, Raspberry Pi, and others
Uses a simple syntax comparable to the English language that lets
developers use fewer lines than other programming languages
Operates on an interpreter system that allows code to be executed
immediately, fast-tracking prototyping
Can be handled in a procedural, object-orientated, or functional
way
Python Syntax
Somewhat similar to the English language, with a mathematical
influence, Python is built for readability
Unlike other languages that use semicolons and/or parentheses to
complete a command, Python uses new lines for the same function
Defines scope (i.e., loops, functions, classes) by relying indentation,
using whitespace, rather than braces (aka curly brackets)
Python Flexibility
Python, a dynamically typed language, is especially flexible, eliminating
hard rules for building features and offering more problem-solving
flexibility with a variety of methods. It also allows uses to compile and run
programs right up to a problematic area because it uses run-time type
checking rather than compile-time checking.
The Less Great Parts of Python
On the down side, Python isn’t easy to maintain. One command can have
multiple meanings depending on context because Python is a dynamically
typed language. And, maintaining a Python app as it grows in size and
complexity can be increasingly difficult, especially finding and fixing
errors. Users will need experience to design code or write unit tests that
make maintenance easier.
Speed is another weakness in Python. Its flexibility, because it is
dynamically typed, requires a significant amount of referencing to land on
a correct definition, slowing performance. This can be mitigated by using
alternative implementation of Python (e.g. PyPy).
Python and AI
AI researchers are fans of Python. Google TensorFlow, as well as other
libraries (scikit-learn, Keras), establish a foundation for AI development
because of the usability and flexibility it offers Python users. These
libraries, and their availability, are critical because they enable developers
to focus on growth and building.
HARDWARE AND SOFTWARE REQUIREMENTS
Hardware Requirements
Component Specification
Operating System Windows 7/8/10/11, macOS, or Linux
Python Version Python 3.6 or higher
Text Editor / IDE IDLE / VS Code / PyCharm / Sublime Text
pickle (standard module, no installation
Python Modules
needed)
File Type Used Binary file (student.dat)
Software Requirements
Component Specification
Operating System Windows 7/8/10/11, macOS, or Linux
Python Version Python 3.6 or higher
Text Editor / IDE IDLE / VS Code / PyCharm / Sublime Text
Python Modules pickle (standard module, no installation needed)
File Type Used Binary file (student.dat)
ABOUT THIS PROJECT
The Student Record Management System is a Python-based
console application developed to manage student data
through binary file handling. The project is structured to
handle three key pieces of information for each student:
Admission Number, Name, and Percentage. It uses the pickle
module to store these records in a binary file named
student.dat.
Each student record is stored as a list containing the three
elements: [adm_no, name, percentage]. The use of the pickle
module allows for the serialization and deserialization of this
data, enabling it to be written to and read from the binary file
efficiently. The file operations are performed in modes such
as ab (append binary), rb (read binary), rb+ (read and write
binary), and wb (write binary).
The application provides a menu-driven interface that allows
the user to perform the following operations:
1. Add Records: The user inputs admission number, name,
and percentage. This data is stored as a list and
appended to the file using pickle.dump().
2. Display All Records: The system reads the binary file
using pickle.load() in a loop and prints all student
records until the end of the file is reached.
3. Search Record: Users can search for a student by
admission number, name, or percentage. The search is
done by comparing the input with the corresponding
field in each record.
4. Update Record: Once a record is found using any of the
fields, the user can choose to update the admission
number, name, percentage, or all fields. The record is
then rewritten at the same file position using file.seek()
and pickle.dump().
5. Delete Record: The file is read, and all records except
the one matching the search field are copied into a list.
This list is then written back to the file, effectively
deleting the selected record.
The logic in the program ensures that each function operates
independently yet integrates seamlessly with others. It uses
exception handling to manage EOFError while reading the
binary file. The file remains intact and accessible between
runs, as all data is permanently stored unless deliberately
deleted.
This project is a complete demonstration of how structured
data can be created, read, updated, and deleted using
Python and binary file operations.
SOURCE CODE
import pickle
# Function to add student records
def CreateFile():
with open("student.dat", "ab") as file:
while True:
adm_no = int(input("Enter Admission Number: "))
name = input("Enter Name: ")
percentage = float(input("Enter Percentage: "))
student = [adm_no, name, percentage]
pickle.dump(student, file)
choice = input("Do you want to add more records?
(Y/N): ")
if choice.lower() == 'n':
break
print("Records saved successfully.\n")
# Function to display all records
def DisplayAll():
try:
with open("student.dat", "rb") as file:
print("\nAll Student Records:")
print("-" * 30)
while True:
try:
student = pickle.load(file)
print(f"Adm No: {student[0]}, Name:
{student[1]}, Percentage: {student[2]}")
except EOFError:
break
except FileNotFoundError:
print("File not found.")
# Function to search a record by any field
def SearchRecord():
found = 0
try:
with open("student.dat", "rb") as file:
field = input("Search by (adm_no / name /
percentage): ").strip().lower()
if field not in ["adm_no", "name", "percentage"]:
print("Invalid field!")
return
if field == "adm_no":
search_value = int(input("Enter Admission Number:
"))
elif field == "name":
search_value = input("Enter Name: ").strip()
elif field == "percentage":
search_value = float(input("Enter Percentage: "))
while True:
try:
data = pickle.load(file)
if (field == "adm_no" and data[0] ==
search_value) or \
(field == "name" and data[1].lower() ==
search_value.lower()) or \
(field == "percentage" and data[2] ==
search_value):
print("Record Found:", data)
found = 1
break
except EOFError:
break
except FileNotFoundError:
print("File not found.")
if not found:
print("Record not found.")
# Function to update a record by any field
def UpdateRecord():
found = 0
try:
with open("student.dat", "rb+") as file:
field = input("Search by (adm_no / name /
percentage): ").strip().lower()
if field not in ["adm_no", "name", "percentage"]:
print("Invalid field!")
return
if field == "adm_no":
search_value = int(input("Enter Admission Number
to search: "))
elif field == "name":
search_value = input("Enter Name to search:
").strip()
elif field == "percentage":
search_value = float(input("Enter Percentage to
search: "))
while True:
current_pos = file.tell()
try:
data = pickle.load(file)
if (field == "adm_no" and data[0] ==
search_value) or \
(field == "name" and data[1].lower() ==
search_value.lower()) or \
(field == "percentage" and data[2] ==
search_value):
found = 1
print(f"Current Record: Adm No: {data[0]},
Name: {data[1]}, Percentage: {data[2]}")
print("What do you want to update?")
print("1. Admission Number")
print("2. Name")
print("3. Percentage")
print("4. All Fields")
choice = input("Enter your choice (1-4): ")
if choice == '1':
data[0] = int(input("Enter new Admission
Number: "))
elif choice == '2':
data[1] = input("Enter new Name: ")
elif choice == '3':
data[2] = float(input("Enter new
Percentage: "))
elif choice == '4':
data[0] = int(input("Enter new Admission
Number: "))
data[1] = input("Enter new Name: ")
data[2] = float(input("Enter new
Percentage: "))
else:
print("Invalid choice. No changes made.")
break
file.seek(current_pos)
pickle.dump(data, file)
print("Record updated successfully.")
break
except EOFError:
break
except FileNotFoundError:
print("student.dat not found.")
if not found:
print("Record not found.")
# Function to delete a record by any field
def DeleteRecord():
found = 0
try:
field = input("Delete by (adm_no / name / percentage):
").strip().lower()
if field not in ["adm_no", "name", "percentage"]:
print("Invalid field!")
return
if field == "adm_no":
search_value = int(input("Enter Admission Number to
delete: "))
elif field == "name":
search_value = input("Enter Name to delete: ").strip()
elif field == "percentage":
search_value = float(input("Enter Percentage to
delete: "))
with open("student.dat", "rb") as file:
records = []
while True:
try:
data = pickle.load(file)
match = (field == "adm_no" and data[0] ==
search_value) or \
(field == "name" and data[1].lower() ==
search_value.lower()) or \
(field == "percentage" and data[2] ==
search_value)
if match:
print("Deleting Record:", data)
found = 1
continue
records.append(data)
except EOFError:
break
with open("student.dat", "wb") as file:
for rec in records:
pickle.dump(rec, file)
if found:
print("Record deleted successfully.")
else:
print("Record not found.")
except FileNotFoundError:
print("student.dat not found.")
# Menu function
def Menu():
while True:
print("\n====== STUDENT RECORD SYSTEM
======")
print("1. Add Student Records")
print("2. Display All Records")
print("3. Search Record by Any Field")
print("4. Update Record by Any Field")
print("5. Delete Record by Any Field")
print("6. Exit")
choice = input("Enter your choice (1-6): ")
if choice == '1':
CreateFile()
elif choice == '2':
DisplayAll()
elif choice == '3':
SearchRecord()
elif choice == '4':
UpdateRecord()
elif choice == '5':
DeleteRecord()
elif choice == '6':
print("Exiting... Goodbye!")
break
else:
print("Invalid choice. Try again.")
# Start the program
Menu()
OUTPUT
FUTURE ENHANCEMENTS
While the current version of the Student Record
Management System performs basic operations like adding,
displaying, searching, updating, and deleting student records
using binary files, the project can be significantly improved
and expanded. Below are several future enhancements that
can make the system more user-friendly, robust, and
powerful:
1. Graphical User Interface (GUI)
Integrate the system with a GUI using Tkinter, PyQt, or
Kivy.
This will replace the command-line interface with user-
friendly buttons, forms, and visual elements, making the
system easier to use for non-technical users.
2. Database Integration
Replace binary file storage with a relational database
like SQLite, MySQL, or PostgreSQL.
This would allow better data management, querying,
indexing, and scalability.
3. Data Export Options
Add functionality to export records to CSV, Excel, or PDF
formats.
Useful for sharing reports, backups, or printing student
data.
4. Search Filters and Sorting
Implement advanced search filters (e.g., search by
percentage range or partial name match).
Add sorting functionality to view records ordered by
name, percentage, or admission number.
5. User Authentication
Introduce login credentials for different users (e.g.,
admin, staff).
Prevent unauthorized access or modification of student
data.
6. Record Validation and Error Handling
Improve input validation to check for duplicate
admission numbers, invalid percentages, or empty
fields.
Add detailed error messages for better debugging and
user guidance.
7. Mobile App Compatibility
Create a lightweight version of the system for Android
using Kivy or BeeWare frameworks.
This allows managing student records on-the-go via
mobile devices.
8. Cloud Integration
Enable cloud-based storage using platforms like Firebase
or AWS.
Makes the data accessible from multiple devices or
locations in real-time.
9. Report Generation
Generate auto-formatted reports like:
o List of top-performing students
o Students below a certain percentage
o Attendance tracking (if extended)
10. Data Backup and Restore
Implement automatic or manual backup options.
Users can restore data in case of file corruption or
accidental deletion.