File tree 1 file changed +68
-0
lines changed
1 file changed +68
-0
lines changed Original file line number Diff line number Diff line change
1
+ singlerecord = []
2
+ studList = []
3
+ choice = 'y'
4
+ while choice .lower ()!= 'n' :
5
+ studName = input ('enter your name ' )
6
+ Rollno = input ('enter your Rollno ' )
7
+ cgpa = int (input ('cgpa :' ))
8
+ singlerecord .append (studName )
9
+ singlerecord .append (Rollno )
10
+ singlerecord .append (cgpa )
11
+ studList .append (singlerecord )
12
+ singlerecord = []
13
+ choice = input ('enter your choice [y/n]' )
14
+
15
+ #append
16
+ def appendStudent ():
17
+ global studList
18
+ singlr = []
19
+ studName = input ('enter your name' )
20
+ Rollno = input ('enter your Rollno' )
21
+ cgpa = int (input ('cgpa :' ))
22
+ singlr .append (studName )
23
+ singlr .append (Rollno )
24
+ singlr .append (cgpa )
25
+ studList .append (singlr )
26
+
27
+
28
+ # remove existing record by rollno
29
+ def removeRecord ():
30
+ global studList
31
+ rolln = int (input ("enter student's rollno:" ))
32
+ for record in studList :
33
+ if rolln in record :
34
+ studList .remove (record )
35
+
36
+ # view student by name:
37
+ def viewRecord ():
38
+ name = input ("enter student's name:" )
39
+ for record in studList :
40
+ if name in record :
41
+ print (record )
42
+
43
+ # copy
44
+ def copyList ():
45
+ print ("what to do??" )
46
+
47
+ #remove all
48
+ def removeAll ():
49
+ studList .clear ()
50
+
51
+ flag = 'y'
52
+ while (flag == 'y' ):
53
+ 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" ))
54
+ if (find == 1 ):
55
+ appendStudent ()
56
+ elif (find == 2 ):
57
+ removeRecord ()
58
+ elif (find == 3 ):
59
+ viewRecord ()
60
+ elif (find == 4 ):
61
+ copyList ()
62
+ elif (find == 5 ):
63
+ removeAll ()
64
+ elif (find == 6 ):
65
+ exit
66
+ else :
67
+ print ("enter correct option !!" )
68
+ flag = input ("do u want to continue ? say y or n : \n " )
You can’t perform that action at this time.
0 commit comments