Question: IN PYTHON, you'll have to read the content of a text file named In.txt and then reformat it to be justified on both the left

IN PYTHON, you'll have to read the content of a text file named "In.txt" and then reformat it to be justified on both the left and right sides and store the result in a file named "Out.txt".
The length of a single line in the output file is 80 characters.
You should do this by rearranging the words on a single line to fit 80 characters without breaking a word on two lines. You should then redistribute the spaces left between the words of the said line so that every line starts with a word and ends with another (i.e. a line should never end with a space).


Step by Step Solution

3.45 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres a stepbystep guide on how you can achieve text justification in Python Step 1 Read the Input F... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!