-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStudent.py
186 lines (144 loc) · 5.71 KB
/
Student.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
class student(object):
def __init__(self,prn,name,surname,branch,contact):
self.prn = prn
self.name = name
self.surname = surname
self.branch = branch
self.contact = contact
def display(self):
print("\n")
print(self.prn)
print(self.name)
print(self.surname)
print(self.branch)
print(self.contact)
print("\n")
@property
def roll(self):
return self.__roll
@roll.setter
def roll(self,roll):
if roll >0 and roll !=0:
self.__roll = roll
@property
def name(self):
return self.__name
@name.setter
def name(self,name):
if name ==None:
raise"invalid entered name"
else:
self.__name = name
p = 0
while p == 0:
print("\n \n")
print("\n_______________________________________________________________________________ \n \n**** Welcome To the MIT Academy Of Engineering Student Management System **** \n\n1.Insert \n2.Delete \n3.Search \n4.Update \n5.Display All Data Of Student \n6.Quit \n____________________________________________________________________________")
ch = input("enter your choice:-")
if ch == 1:
list1 = []
n = input("\nHow Many Student You Should Add : ")
choice2 = 1
choice3 = 2
choice4 = 3
choice5 = 4
choice6 = 5
for i in range(n):
choice2 = 1
while choice2 == 1:
print('Number Of Student : '+str(i+1))
prn = raw_input("\tprn:--")
if prn == "":
print("enter the something..")
else:
choice2 = 0
choice3 = 2
while choice3 == 2:
name = raw_input('\tName : ')
if name == "":
print("enter the something")
else:
choice3 = 1
choice4 = 3
while choice4 == 3:
surname = raw_input('\tSurname : ')
if surname == "":
print("enter something")
else:
choice4 = 2
choice5 = 4
while choice5 == 4:
branch = raw_input('\tBranch :-')
if branch == "":
print "Enter Something"
else:
choice5 = 3
choice6 = 5
while choice6 == 5:
contact =raw_input('\tContact')
if contact == "":
print "Enter something"
else:
choice6 = 4
list1.append(student(prn,name,surname,branch,contact))
elif ch == 2:
print("1.Delete By PRN:-- \n 2. Delete By Name:--")
choice = input("Enter Your Choice:--")
if choice == 1:
deleteid = raw_input("Enter the PRN: ")
for obj in list1:
if obj.prn == deleteid:
list1.remove(obj)
else:
deleteid = raw_input(" Enter the Name of Student: ")
for obj in list1:
if obj.rollNo == deleteid:
list1.remove(obj)
elif ch == 3:
print("\n1. Search By Name \n2. Search by Branch ")
Searchchoice= input("Enter your Option:---")
if Searchchoice == 1:
names=raw_input("Enter the name of Student :---")
for obj in list1:
if obj.name == names:
print "PRN :-- " ,obj.prn
print "name :-- ",obj.name
print " surname:---",obj.surname
print " Branch :-- ",obj.branch
print " Contact :-- ",obj.contact
elif Searchchoice == 2:
branchs = raw_input("Enter the Branch of student")
for obj in list1:
if obj.branch == branchs:
print "PRN :-- " ,obj.prn
print "name :-- ",obj.name
print " surname:---",obj.surname
print " Branch :-- ",obj.branch
print " Contact :-- ",obj.contact
elif ch == 4:
ustudent = raw_input(" Enter the PRN of student to update : ")
for i in list1:
if i.prn == ustudent:
print("1.prn \n2.name \n3.branch ")
uchoice = input("Enter your choice : ")
if uchoice == 1:
uprn = raw_input("enter new PRN : ")
i.prn = uprn
elif uchoice == 2:
uname = raw_input("enter new name : ")
i.name = uname
elif uchoice == 3:
ubranch = raw_input("enter new branch : ")
i.branch = ubranch
elif ch == 5:
print("\n")
print("MIT Aoe Student DataBase ")
for i in list1:
print("______________________")
print("\n Prn :-- " +i.prn)
print("Name " +i.name)
print(" Surname " +i.surname )
print(" Branch " +i.branch )
print("contact " +i.contact)
print("______________________")
else:
p = 1