Write a function area(type,a,b) that receives a string type (which may be "rectangle", "triangle", or "circle") and two real numbers a and b, and computes the area of the given shape.
Important: Only the function is expected. If you submission includes a main program, it has to be either commented out, or under the condition if __name__ == "__main__":
Observation To get the value of π, add a line with ’import math’ at the top of your file, and then use math.pi when needed.
>>> area('rectangle', 3.1, 4.0) 12.4 >>> area('triangle', 6.0, 2.0) 6.0 >>> area('rectangle', 8.2, 8.2) 67.24 >>> area('circle', 1.0, 0.0) 3.141592653589793