I wrote a small program in python to generate the area of a triangle. I need to add exception handling to inform the user when there is an invalid input.

1 answer below »
I wrote a small program in python to generate the area of a triangle. I need to add exception handling to inform the user when there is an invalid input.
Answered Same DayNov 10, 2021

Answer To: I wrote a small program in python to generate the area of a triangle. I need to add exception...

Aditya answered on Nov 11 2021
158 Votes
try:
base = float(input('What is the base?'))
height = float(input('What is the height?'))

area = (1/2)*base*height
print("The area of the triang is", area)
except ValueError:
print('Invalid Input')
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here