(4 pts) Write a python program that does the following: 1. Reads a ‘input.txt’ file that contains numbers and sentences

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

(4 pts) Write a python program that does the following: 1. Reads a ‘input.txt’ file that contains numbers and sentences

Post by answerhappygod »

(4 pts) Write a python program that does the following:
1. Reads a ‘input.txt’ file that contains numbers andsentences
2. Computes and displays the average of numerical values to afile ‘output.txt’.
3. Joins sentences using a ‘. ’ (dot + space) separator, anddisplays joined text to a file ‘output.txt’.
Notes:
a. Your program should handle empty lines as an emptystring.
b. Hint: You can use the .join() function to concatenate or joinsentences:https://www.programiz.com/python-progra ... tring/join
c. Assume only positive numerical values in the input file
d. If you have a blank line, you should append ‘. ’ (dot +space) to the concatenated text
e. Refer to the sample text file (q2_text_sample.txt underHomework 3) to understand how the sample string in the output filebelow is concatenated
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply