Please enable JavaScript to use CodeHS

Demos

Area and Perimeter


Calculate the Area


##Fill in the `calculate_area` function to print the area of the triangle to the screen. Hint: The base of your triangle is set to 200 pixels. Where is the height of your triangle saved? You'll need to use the `write_text` function to print the value to the screen!

Putting Triangles into Categories using Variables


##Use the variable `base` inside the `determine_triangle_type` function to print the type of triangle to the screen. You'll first need to decide how to determine the x and y values that will create the following types of triangles with a changing base value: * Obtuse Triangle (one angle larger than 90 degrees) * Right Triangle (one angle equal to 90 degrees) * Equilateral Triangle (all angles and side lengths equal) * Acute Triangle (all angles less than 90 degrees) <ln> Hint: The base of your triangle could be set to any value. * Pythagorean Theorem and trigonometry must be used to create equations for each scenario using the variable `base` * You'll need to use the `write_text` function to print the label to the screen!