Write a program that will read a file from the user and writes its content in another file such that each line contains only 8 words. Coding language python Don't use pointers and arrays keep the program as simple as possible (beginner's level) Paste the screenshots of full program with output) inputfile = input('Enter filename to read: ') outputfile = input('Enter filename to write: ') f = open(inputfile,'r') f1 = open(outputfile,'w') for lines in f: f1.writelines(lines) f.close() f1.close() ***write comments on each line of the above written program and make changes in it with accordance to question if anything is wrong and also check if the underlined part of question is solved in program or not
(Q. Write a program that will read a file from the user and writes its content in another file such that each line contains only 8 words.
Coding language python
Don't use pointers and arrays keep the program as simple as possible (beginner's level)
Paste the screenshots of full program with output)
inputfile = input('Enter filename to read: ')
outputfile = input('Enter filename to write: ')
f = open(inputfile,'r')
f1 = open(outputfile,'w')
for lines in f:
f1.writelines(lines)
f.close()
f1.close()
***write comments on each line of the above written program and make changes in it with accordance to question if anything is wrong and also check if the underlined part of question is solved in program or not
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images