IT Project

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 14

SOURCE CODE:

dict1={}
def add():
while True:
name=input("enter name of student: ")
rollno=input("enter roll number of
student: ")
mark=input("enter mark of student: ")
if rollno in dict1:
print("Roll no already exists,
enter another roll no.")
else:
dict1[rollno]=[name,mark]
print("student added
successfully:", rollno,":",dict1[rollno])
break
def display():
print('Rollno','\t','Name','\t','Mark')
for i in dict1:
print(i,'\t',dict1[i][0],'\t',dict1[i]
[1])
def search():
print("1.Search by Roll no \n2.Search by
Name \n3.Search by Marks")
z=int(input("Select the choice:"))
if z==1:
s=input("Enter roll number to be
searched:")
for i in dict1:
if i==s:
print(dict1[i])
break
if z==2:
s=input("Enter Name to be searched:")
for i in dict1:
if dict1[i][0]==s:
print(dict1[i])
break
if z==3:
m=input("Enter Marks to be searched:")
n=input("Enter Name to be searched:")
for i in dict1:
if dict1[i][1]==m:
print(dict1[i])
break

def modify():
print("1.Modify name \n2.Modify marks")
y=int(input("Enter Choice:"))
if y==1:
enam=input("Enter roll no:")
nnam=input("Enter the new name:")
dict1[enam][0]=nnam
if y==2:
emar=input("Enter roll no:")
nrol=input("Enter new Mark:")
dict1[emar][1]=nrol
def delete():
print("1.Delete by Roll number \n2.Delete
by Name")
y=int(input("Enter Choice:"))
if y==1:
erol=input("Enter roll number:")
for i in dict1:
if i==erol:
break
del dict1[i]
if y==2:
enem=input("Enter Name:")
for i in dict1:
if dict1[i][0]==enem:
break
del dict1[i]
while True:
print()
print()
print("\n1.Add a record \n2.Display all
records \n3.Delete a record \n4.Modify a record
\n5.Search a record \n6.Exit")
n=int(input("Select Choice:"))

if n==1:
add()
if n==2:
display()
if n==3:
delete()
if n==4:
modify()
if n==5:
search()
if n==6:
break

OUTPUT:
1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:1
enter name of student: Chris
enter roll number of student: 6
enter mark of student: 90
student added successfully: 6 : ['Chris', '90']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:1
enter name of student: Ron
enter roll number of student: 27
enter mark of student: 91
student added successfully: 27 : ['Ron', '91']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:1
enter name of student: Joel
enter roll number of student: 16
enter mark of student: 92
student added successfully: 16 : ['Joel', '92']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:1
enter name of student: Ryan
enter roll number of student: 28
enter mark of student: 89
student added successfully: 28 : ['Ryan', '89']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:1
enter name of student: Joe
enter roll number of student: 15
enter mark of student: 87
student added successfully: 15 : ['Joe', '87']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:2
Rollno Name Mark
6 Chris 90
27 Ron 91
16 Joel 92
28 Ryan 89
15 Joe 87
1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:3
1.Delete by Roll number
2.Delete by Name
Enter Choice:1
Enter roll number:15

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:3
1.Delete by Roll number
2.Delete by Name
Enter Choice:2
Enter Name:Ryan

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:2
Rollno Name Mark
6 Chris 90
27 Ron 91
16 Joel 92

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:4
1.Modify name
2.Modify marks
Enter Choice:1
Enter roll no16
Enter the new name:Paul

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:4
1.Modify name
2.Modify marks
Enter Choice:2
Enter roll no27
Enter new Mark95
1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:2
Rollno Name Mark
6 Chris 90
27 Ron 95
16 Paul 92

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:5
1.Search by Roll no
2.Search by Name
3.Search by Marks
Select the choice:1
Enter roll number to be searched:6
['Chris', '90']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:5
1.Search by Roll no
2.Search by Name
3.Search by Marks
Select the choice:2
Enter Name to be searched:Ron
['Ron', '95']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:5
1.Search by Roll no
2.Search by Name
3.Search by Marks
Select the choice:3
Enter Marks to be searched92
Enter Name to be searched:Paul
['Paul', '92']

1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:2
Rollno Name Mark
6 Chris 90
27 Ron 95
16 Paul 92
1.Add a record
2.Display all records
3.Delete a record
4.Modify a record
5.Search a record
6.Exit
Select Choice:6

You might also like