PYTHON Part 2 (separate program) Ask for a file name. Don’t let the program crash if you...

60.1K

Verified Solution

Question

Programming

PYTHON

Part 2 (separate program)

Ask for a file name. Don’t let the program crash if you enterthe name of a file that does not exist. Detecting this will also bediscussed on Wednesday. If the file doesn’t exist gracefullydisplay an error message stating the file doesn’t exist and quitthe program. It the file does exist read all the values in thefile. You will only need to read the file once, or more to thepoint, only read the file once. After the program has finishedreading all the data, display the following information to thescreen:

• The minimum value

• The maximum value

• If any values were 100. No output if no values were100.

• If any values were 0. No output if no values were0.

• The average – display with 4 places after the decimalpoint

• The total number of values

• The total number of values greater than or equal to 75

• The total number of values less than 75

• The value closest to 75 (can be 75, less than 75 or greaterthan 75). abs will be useful for this value.

• The value closest to 75 WITHOUT going over 75 (can be 75, WILLNOT be greater than 75) If no data exists in the file, write out asimple message indicating that there was no data in the file andnothing else.

**I really need something to compare my work to and amstruggling with adding the \"100 or 0\" part.

Answer & Explanation Solved by verified expert
3.7 Ratings (339 Votes)
code in python code to copyfrom pathlib import Path Prints The maximum and minimum valuedef printMinMaxlist iflenlist0 printMin List is empty printMax List is empty else minnumlist0 maxnumlist0 for item in list minnumminminnum item maxnummaxmaxnum item printMin minnum printMax maxnum f any values were 100 No output if no values were 100 If any    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students