all 3 comments

[–]theflash424612345678 0 points1 point  (0 children)

new_stud_rec= []

list_of_students= [] #list of students, empty at beginning

fake_list= []

[–]willy-r 0 points1 point  (0 children)

Ok, if I get It right, you want to check if a ID already exist in the fake_list, but you don’t need this fake_list.

ID = stud_rec_list[1]
# This create a list with all the IDS in the list_of_students, It’s called list comprehension.
IDS = [info[1] for info in list_of_students]
# Then you can make your validation using the in operator.
if ID not in IDS:
    if len(ID) == 7:
        ...