171. Python Program to Copy a Text File
Mediumopen()
Overview
Use the right file mode for each job: one file to read from, another to write to.
Problem Statement
Read one line of text and write it into a file called original.txt. Then copy the file: read everything in original.txt and write it into a new file called copy.txt. Finally, read copy.txt and print two lines:
Copy:followed by the text incopy.txt.Characters:followed by the number of characters in it.
Your program runs in the browser, so the file lives only in this tab's memory. Create it with "w" before you read it.
Use input() with no prompt text: the tests type the input for you, and a prompt would end up in your output.
Input
One line of text. Example:
Hello, Sunny!
Output
The output for that example:
Copy: Hello, Sunny!
Characters: 13
The tests try 3 different inputs.