Write a function that takes a group number and outputs a numbered and alphabetically ordered list (surnames, first names, patronymics) of all students in that group from the dictionary dct. dct = {'0001': ['Antonov', 'Anton', 'Igorevich', '20.08.2009', 'BST161'], '1102': ['Bogov', 'Artem', 'Igorvich', '25.01.2010', 'BST162'], '0333': ['Glagoleva', 'Anastasia', 'Nikolaevna', '11.07.2009', 'BST163'], '4004': ['Potapov', 'Dmitry', 'Stanislavovich', '14.02.2012', 'BST161'], '0045': ['Bokov', 'Igor', 'Kharitonovich', '02.06.2009', 'BST161'], '0096': ['Vasilkov', 'Valentin', 'Sergeevich', '20.03.2009', 'BST164'], '0607': ['Siropova', 'Violetta', 'Eduardovna', '28.05.2010', 'BST162']}
def name_list(group, dct): lst = [] for key, value in dct.items(): if value[-1] == group: lst.append(value[0] + ' ' + value[1] + ' ' + value[2]) lst.sort() for i in range(len(lst)): print('{}. {}'.format(i + 1, lst[i])) name_list('BST161', dct)