Answered step by step
Verified Expert Solution
Link Copied!

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.
image text in transcribed
image text in transcribed
Ansab 100010 Tawyan 14008.5 Shams 10006d Sadaf -700 7 Tanuf 9008 Wadi Diqa 150020 AlKhodh 8509 Sample output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

Students also viewed these Databases questions

Question

2. Show the trainees how to do it without saying anything.

Answered: 1 week ago