Question: Problem Statement: Write a function read _ number that will read in the data from a file. It will receive the name of the file

Problem Statement: Write a function read_number that will read in the data from a file. It will receive the name of the file as an argument, it will open the file for reading, and it will read the numbers in the file. Each number is separated with a blank space. It will return the list of numbers. Make sure that your function can handle any errors in the input file. If there is any non-numerical data then it must ignore that data point.
Write a function calc_prod which will receive a list of numbers as an argument. It will calculate the product of all the numbers and will return the result.
Write main function which will ask the user for name of the input file, it will call the read_number function to read in the data from the input file, call the calc_prod to calculate the product of numbers and will display the result.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!