question archive This is what final product should show below! ————————————————————————————————————————— Processing file good_data

This is what final product should show below! ————————————————————————————————————————— Processing file good_data

Subject:Computer SciencePrice:4.86 Bought8

This is what final product should show below!

—————————————————————————————————————————

Processing file good_data.txt

Record count =  6

Total        =  281

Average      =  46.83 

 

Processing file bad_data.txt

Error! bad_data.txt contains non-numeric data

 

Processing file empty_file.txt

Error! empty_file.txt  is empty. Cannot calculate average

 

Processing file does_not_exist.txt

Error! does_not_exist.txt  File not found

——————————————————————————————————

# This is code I have so far having trouble getting it to print out error if none int in data files. It needs to be all numbers for # it to get average, total and record count. I will send link with files under this.

#. https://we.tl/t-RpShgnzCkr

 

def main():

  process_file("good_data.txt")

  process_file("bad_data.txt")

  process_file("empty_file.txt")

  process_file("does_not_exist.txt")

def process_file(param_str_file_name):

 record count = 0

 total = 0

 average = 0

  print("Processing file", param_str_file_name)

    print("tError!", param_str_file_name, " is empty. Cannot calculate averagen")

    print("tRecord count = ", num_rec)

  print("tTotal    = ", total)

  print("tAverage   = " , f"{total/num_rec:.2f}", "n")

  print("tError!", param_str_file_name, " File not foundn")

  .  print("tError!", param_str_file_name, "contains non-numeric datan")

if __name__ == "__main__":

  main()

Option 1

Low Cost Option
Download this past answer in few clicks

4.86 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 8 times

Completion Status 100%