-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProject1.py
More file actions
54 lines (48 loc) · 1.68 KB
/
Copy pathProject1.py
File metadata and controls
54 lines (48 loc) · 1.68 KB
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
stds=list()
while True:
opt=input("Enter your choice:\n 1.Enter new student\n 2.Print all\n 3.Search\n 4.Remove\n 5.Update\n 6.Sort or 'done' to exit\n").lower()
if opt=="done":
break
elif opt=="1":
name=input("Enter FN LN TERM GPA REG_NU : ").lower()
stds.append(name)
elif opt=="2":
for i in range(0,len(stds)):
print("Student ",i,":",stds[i],"\n")
elif opt=="3":
reg1=input("Enter REG_NU to Search for student : ")
for name in stds :
if reg1 in name:
print(name,"\n")
break
else :
print("Not Found!")
elif opt=="4":
reg2=input("Enter REG_NU to remove student : ")
for name in stds :
if reg2 in name:
stds.remove(name)
for i in range(0,len(stds)):
print("Student ",i,":",stds[i],"\n")
break
else :
print("Not Found!")
break
elif opt=="5":
reg3=input("Enter REG_NU to Update student's data : \n")
for i in range(0,len(stds)):
if reg3 in stds[i]:
print(stds[i])
new_name=input("\nEnter the new data for student : " ).lower()
stds[i]=new_name
break
elif opt=="6":
opt1=input("1.Sort a-z\n2.Sort z-a\n")
if opt1=="1":
stds=sorted(stds)
for i in range(0,len(stds)):
print("Student ",i,":",stds[i],"\n")
elif opt1=="2":
stds=sorted(stds,reverse=True)
for i in range(0,len(stds)):
print("Student ",i,":",stds[i],"\n")