I am calculating the age of the students from their date of birth and add it to the data:
def display():
new = []
print("\n STUDENT LIST")
print("\n ID | NAME | SURNAME | SEX | DOB | COB | AGE \n")
for line in students:
line.append(age(str(line[4])))
new.append(line)
for newlines in new:
print(newlines)
The problem is that the output of this keeps appending it to the very end every time the function is called. I want to be able to only append the lines that have a length of 6. The ones that already have a length of 6 should be ignored.
First Run:
Second Run: