-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchoosewhile.py
44 lines (43 loc) · 1.38 KB
/
choosewhile.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
ans='y'
student=[]
while ans=='y':
print('1, Add Name')
print('2, Search Name')
print('3, Show All')
print('4, Modify')
print('5, Delete')
print('6, Exit')
print("Enter Choice")
ch=((int)(input())
print(ch)
if ch==1:
name=input("Enter name")
student.append(name)
print("Record Saved")
elif ch==2:
name=input("Enter name for search")
if name in student:
print("Name Found", name)
else:
print("Name not found",name)
elif ch==3:
for x in student:
print(x)
elif ch==4:
oldname=input('oldname')
newname=input('newname')
if oldname in student:
i=student.index(oldname)
student[i]=newname
print ("Record Updated", student)
elif ch==5:
dname="Enter name to delete"
if dname in student:
student.remove(dname)
print("Record Deleted")
else:
print("Record not found")
elif ch==6:
exit(0)
print("continue y/n")
ans=input()