4.4 Write a program which reads the social security number SOC of a student and uses LINEAR to find and print the student's record. Test the program using (a) 174-58-0732, (b) 172-55 5554 and (c) 126-63-6382.
n=int(input("Enter number of students: "))
soc=[]
names=[]
address=[]
course=[]
for i in range(n):
print("Enter details for student ",i)
s=input("Enter social security number: ")
soc.append(s)
n=input("Enter student name: ")
names.append(n)
a=input("Enter student address: ")
address.append(a)
c=input("Enter course: ")
course.append(c)
num=input("Enter social security number of the student: ")
print("The student record is as follows: ")
index=0
for i in range(n):
if(soc[i]==num):
index=i
print("social security code: ",num);
print("Name: ",names[index]);
print("Address: ",address[index]);
print("Course: ",course[index]);
Comments
Leave a comment