-
Notifications
You must be signed in to change notification settings - Fork 415
/
Copy pathmenu-based_student_record.py
68 lines (61 loc) · 1.69 KB
/
menu-based_student_record.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
singlerecord=[]
studList=[]
choice='y'
while choice.lower()!='n':
studName=input('enter your name ')
Rollno=input('enter your Rollno ')
cgpa=int(input('cgpa :'))
singlerecord.append(studName)
singlerecord.append(Rollno)
singlerecord.append(cgpa)
studList.append(singlerecord)
singlerecord=[]
choice=input('enter your choice [y/n]')
#append
def appendStudent():
global studList
singlr = []
studName=input('enter your name')
Rollno=input('enter your Rollno')
cgpa=int(input('cgpa :'))
singlr.append(studName)
singlr.append(Rollno)
singlr.append(cgpa)
studList.append(singlr)
# remove existing record by rollno
def removeRecord():
global studList
rolln=int(input("enter student's rollno:"))
for record in studList:
if rolln in record:
studList.remove(record)
# view student by name:
def viewRecord():
name=input("enter student's name:")
for record in studList:
if name in record:
print(record)
# copy
def copyList():
print("what to do??")
#remove all
def removeAll():
studList.clear()
flag = 'y'
while (flag == 'y'):
find = int(input("Enter \n option 1 : Append student \n option 2: remove student by Rollno\n option 3: view student by name\n option 4: copy list\n option 5: remove all students option \n 6: exit"))
if (find == 1):
appendStudent()
elif (find == 2):
removeRecord()
elif (find == 3):
viewRecord()
elif (find == 4):
copyList()
elif (find == 5):
removeAll()
elif (find == 6):
exit
else:
print("enter correct option !!")
flag = input("do u want to continue ? say y or n : \n")