Please provide #comments for what the code is doing.def read_file(file):dict1 = {}with open(file, ‘r’) as nfile: lines = nfile.readlines() for dex in range(0, len(lines) – 1, 2): if lines[dex].strip() == ”: continue count = int(lines[dex].strip()) show = lines[dex + 1].strip() if count in dict1.keys(): show_list = dict1.get(count) show_list.append(show) else: dict1[count] = [show]return dict1def output_keys(dict1, filename): with open(filename, ‘w+’) as q: for key in sorted(dict1.keys()): q.write(‘{}: {}n’.format(key, ‘; ‘.join(dict1.get(key)))) print(‘{}: {}’.format(key, ‘; ‘.join(dict1.get(key))))def output_names(dict1, filename): names = [] for name in dict1.values(): names.extend(name) with open(filename, ‘w+’) as outfile: for name in sorted(names): outfile.write(‘{}n’.format(name)) print(name)def main(z): file = z dict1 = read_file(file) if dict1 is None: print(‘Error: Invalid file name provided: {}’.format(file)) return output_filename_1 = ‘output_keys.txt’ output_filename_2 = ‘output_names.txt’ output_keys(dict1, output_filename_1) output_names(dict1, output_filename_2)user_input = input()main(user_input)Computer ScienceEngineering & TechnologyPython Programming IT- 140

Order your essay today and save 20% with the discount code ESSAYHELP