Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a python program that reads from a text file (whose name is provided by the user) dams data where each line contains the name
Write a python program that reads from a text file (whose name is provided by the user) dams data where each line contains the name of the dam, the rainfall amount and the dimension of the dam. Your program should compute the dam capacity and prints Flood if the rainfall amount exceeds the dam capacity where capacity= 10*dimension**2. Your program should consider the following erroneous cases and display appropriate message as shown in the sample output below:
The file does not open/exist
The rainfall and the dimension values are invalid (non-numeric)
The rainfall or dimension values are negatives, raise a ValueError "negative value", and the
processing should continue.
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