Computing Areas

Write a function area(type,a,b)area(type,a,b) that receives a string typetype (which may be "rectangle", "triangle", or "circle") and two real numbers aa and bb, 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 π\pi, add a line with ’import math’ at the top of your file, and then use math.pi when needed.

Problem information

Author: ProAl1 professors

Generation: 2026-01-25T17:01:58.817Z

© Jutge.org, 2006–2026.
https://jutge.org