In: Computer Science
Write a script named numberlines.py. This script creates a program listing from a source program.
This script should:
1> This is the first line of text.
CODE: Python Programming Language
# numberlines.py
input_filename = input('Enter input file name: ')
output_filename = input('Enter output file name: ')
with open(input_filename, 'r') as f, open(output_filename, 'w')
as w:
number = 0
for line in f:
number += 1
w.write('{:>4}>
{}'.format(number, line))
============================================================================
SCREENSHOT OF THE CODE:
============================================================================
INPUT:
numberlines.txt
This is the first line of text.
OUTPUT:
numberlines_output.txt
Thank you.