See attached file

1 answer below »
Answered Same DayMar 10, 2021

Answer To: See attached file

Ximi answered on Mar 11 2021
152 Votes
# Change the code below.
# For each function:
#
# 1) take the incoming arguments and try to convert th
em to numeric values (basic errors people can make), adding additional try/catch statements that provide MEANINGFUL feedback to the user. (3 pts)
# i.e. float(var) or int(var) C
#
# 2) Call the function and test for None. If None or False is passed in for any value, check to see if the value is set, using if/else. If not set, use a print statement to tell the user that they need to pass in a value.
l=12
w=15
h=7
checks = [None, False]
# your calc_area() here
def calc_area(x, y):#defining a function called calc_area that contain the parameters x, y
try:
if x in checks or y in checks:
raise ValueError("Please pass some value")
area = float(x) * float(y) #the area is equal to x times y, the variable name area is local to this function
return area #the function returns the variable area
except:
print("Could not calculate area")
return False #False is 0, so it returns that
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here