Question: Can you send me answer for this question, I want to check if my answer correct? Write a python program that would read a file.
Can you send me answer for this question, I want to check if my answer correct?
Write a python program that would read a file. The file is called numbers.txt. It has one integer per line and the number can be between 1 and 999 as in this sample. Write a Python program that calls a function readFile("numbers.txt") that that receives the file name from the MAIN. The function opens the file for reading and returns False for any error that could happen throughout the function. If the function works well, it returns True to MAIN. The function should open the file for reading, and reads numbers, line by line. Each time it reads a number, it has to convert that number into words. For example, if the number in the file is 89, it would be converted to Eighty Nine. The function should write the resulting string to a new file called strings.txt one number (string) per line. It would be a good idea to have a print statement before starting to open the first file for reading, before starting to open the second file for writing and when the program MAIN receives True or False back from the function.
Sample run: Starting to read from file numbers.txt . Starting to write to file strings.txt . Files were processed successfully.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
