Computers and Technology
Computers and Technology, 30.03.2021 20:10, kahliey

Write a Python function named backwards that takes two str parameters: an input filename and an output filename. The function shall open the input file, read its contents, and create the output file with the words of each line in reverse order. Notes: • The newline character ('\n') still appears at the end of the line. • You do not have to provide comments for this code. • Extra credit for not using the reverse method or the reversed function. Example: If the file seuss. txt has the contents shown below, the following command will create the reversed. txt file, with the indicated contents. backwards(' seuss. txt', 'reversed. txt') The newline character is displayed as an arrow: - seuss. txt The Cat in the Hat Green Eggs and Hamd Fox in Socks Hop on Pop The Lorax - reversed. txt Hat the in Cat The Ham and Eggs Greend Socks in Fox Pop on Нор Lorax The The backwards function you just wrote is in a module named file_operations. Update the module with a testing main function that will call backwards. The testing main shall use seuss. txt as the input file and create the file reversed. txt. The testing main shall run with the module itself is run, but not when the module is imported.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 21:40, minnie7760
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
image
Computers and Technology, 24.06.2019 07:30, sunny644
John recently worked on a project about various programming languages. he learned that though procedural language programs are useful, they have disadvantages too. what is a disadvantage of programs written in procedural languages? a. programs do not represent data complexity. b. programs take more time to execute. c. programs are prone to security threats. d. programs do not interface with multiple platforms.
Answers: 3
image
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
image
Computers and Technology, 24.06.2019 08:20, bob4059
Evaluate the scenario below and indicate how to handle the matter appropriately. situation: michael received an e-mail from what he thought was his doctor’s office, requesting his social security number. since he had just been in to see his doctor last week, he replied to the e-mail with his social security number.
Answers: 2
Do you know the correct answer?
Write a Python function named backwards that takes two str parameters: an input filename and an outp...

Questions in other subjects:

Konu
English, 17.02.2021 21:10
Konu
Chemistry, 17.02.2021 21:10
Konu
Mathematics, 17.02.2021 21:10
Konu
Biology, 17.02.2021 21:10