(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
(4 pts) Write a python program that does the following: 1. Reads a ‘input.txt’ file that contains numbers and sentences
-
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
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!