Question
This is coding with python and I'm in the introductory course so make sure the module and function is not too complex.Thank u! Write a
This is coding with python and I'm in the introductory course so make sure the module and function is not too complex.Thank u!
Write a function sum_all that takes a file handle called handle_in as a parameter. The function reads through the file and returns a list of the numbers encountered and their sum. Digits that occur within words should be ignored. For example, for the text in the file "If I were 21 instead of 53 I'd probably punch you in the nose a 2nd time" should return a list of the numbers encountered 21 and 53, along with their sum 74. You need to only deal with numbers that are surrounded by spaces. Save the function in a PyDev library module named a9_functions.py Write a program q1.py that test sum_all function and prints/writes the returned values (the list of number returned along with their sum) to the output file output_q1.txt. Test your program with the sample file provided text_numbers.txt.
the sample file text_numbers.txt is
"I programed with C for 17 years, C++ for 10+ years, Java for 6 years and Python for 5 years. Through C is not an object oriented language , it's still my 1st preference"
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started