0

I'm currently working on this code. I'm a student and I don't know where do the sort() or sorted have to put. All other define is working excpet for sort_student . the output is not a sorted version of the data.

def sort_student():
    global Attribute
    global student_database
    print (" Student data ")
    with open(student_database, "r", encoding="utf-8") as f:
        reader = csv.reader(f)
        for x in Attribute:
            print(x, end='\t     |')
        print("\n--------------------------------------------------------------------------------")
        for row in reader:
            for item in row:
                sorted(x, key=len)
                print(item, end="\t     |")
            print("\n")
    input("Press any key to continue")
    

0 Answers0