Write a Python function that calculates the area of parallelogram and takes in base, height as input


Topic: Write a Python function that calculates the area of parallelogram and takes in base, height as input

Solution

def area_shape(base, height, shape):
    return {'triangle': 0.5*base*height, 'parallelogram': base*height}[shape]



List all Python Programs