Simple Student Management System Program in Python without Database

In this blog, we are going to see how to create a simple student management system using Python. We are not going to use any database here. This is just a simple program.
The operations we must have in such a system are

1. Accept
This function helps us accept data from the user. It takes data from the user and makes it available to the system so that it can be used while creating the object’s’ student’ and its attributes.

2. Display
This function helps us display the data we have on the screen. This function works along with the object and displays data corresponding to the object.

3. Search
This feature helps us search for any particular in the system.

4. Delete
This function is used to delete any specific entry from our system.

5. Update
This function is used to update data we have on any given student which can be appended and modified as well.

The actions mentioned above are encoded into the system by creating separate functions for each.
Each function performs its task by using python functions and Object-Oriented Programming.
Constructors are used to providing data to the program and finally to the associated object.
Objects are created out of the class Student which are used to call functions and create a system managing data of a particular student.
The student here becomes the object and the data of that student revolves around this object accessible by calling respective functions.

Python program for student management system

# Create class Student
class Student:

    def __init__(self, name, roll, s1, s2):
        self.name = name
        self.roll = roll
        self.s1 = s1
        self.s2 = s2

    # Function to create and append students
    def accept(self, Name, Roll, score1, score2):
        obj = Student(Name, Roll, score1, score2)
        ls.append(obj)

    # Display student details
    def display(self, obj):
        print("Name : ", obj.name)
        print("RollNo : ", obj.roll)
        print("Score1 : ", obj.s1)
        print("Score2 : ", obj.s2)
        print("\n")

    # Search Function
    def search(self, rn):
        for i in range(ls.__len__()):
            if (ls[i].roll == rn):
                return i

            # Deletion

    def delete(self, rn):
        i = obj.search(rn)
        del ls[i]

    # Update Function
    def update(self, rn, No):
        i = obj.search(rn)
        rolln = No
        ls[i].roll = rolln;


ls = []
# Object of class
obj1 = Student('', 0, 0, 0)

print("\nOperations used, ")
print("\n1.Accept Student details\n"
      "2.Display Student Details\n" 
       "3.Search Details of a Student\n"
        "4.Delete Details of Student" 
      "\n5.Update Student Details\n6.Exit")


obj1.accept("A", 1, 100, 100)
obj1.accept("B", 2, 90, 90)
obj1.accept("C", 3, 80, 80)

print("\n")
print("\nList of Students\n")
for i in range(ls.__len__()):
    obj1.display(ls[i])

print("\n Student Found, ")
s = obj1.search(2)
obj1.display(ls[s])

obj1.delete(2)
print(ls.__len__())
print("List after deletion")
for i in range(ls.__len__()):
    obj1.display(ls[i])

obj1.update(3, 2)
print(ls.__len__())
print("List after updation")
for i in range(ls.__len__()):
    obj1.display(ls[i])


print("Thank You !")

Output

Simple Student Management System Program in Python without Database

Also read: Python program to create a simple chat box

 

2 responses to “Simple Student Management System Program in Python without Database”

  1. Kicory says:

    I want to make a program about student mark management if you are teacher you can add or delete or search student mark by entering student name if you are student you can search student mark by entering his name
    Please someone explain me how to write that program using class

  2. Saumitra Deshpande says:

    Try using constructors specifically coded for editing the field that will hold the marks.
    Accept the values through input and assign them to variables that can edit the marks.
    marks=50, increase=25
    marks= marks + increase

Leave a Reply