Using the computational language in python we have to use it to write to a file and read with the code.
<h3>Writing this code in python we have:</h3>
<em>filename = input()</em>
<em>file = open(filename)</em>
<em>lines = file.readlines()</em>
<em>data = {}</em>
<em>for i in range(0, len(lines), 2):</em>
<em> num_seasons = int(lines[i].strip())</em>
<em> show = lines[i + 1].strip()</em>
<em> if num_seasons not in data:</em>
<em> data[num_seasons] = []</em>
<em> data[num_seasons].append(show)</em>
<em>file.close()</em>
<em>file_writer = open('output_keys.txt', 'w')</em>
<em>titles = []</em>
<em>for num_seasons in sorted(data):</em>
<em> shows = []</em>
<em> for show in sorted(data[num_seasons]):</em>
<em> titles.append(show)</em>
<em> file_writer.write(str(num_seasons) + ': ' + '; '.join(data[num_seasons]) + '\n')</em>
<em>file_writer.close()</em>
<em>file_writer = open('output_titles.txt', 'w')</em>
<em>for title in sorted(titles):</em>
<em> file_writer.write(title + '\n')</em>
<em>file_writer.close()</em>
See more about python at brainly.com/question/18502436
#SPJ1