In this challenge we will create a library of functions to apply the different formulas based on the geometry of triangles.
For each function, you will need to design the algorithm using either Pseudo-code or a flowchart, implement the function using the Python trinket provided below and use another algorithm to test your function.
Write a function called getPerimeter() that takes three parameters/arguments a, b, c (the length of each side of a triangle).
Your function should calculate and return the perimeter of this triangle.
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the length of the 3 sides of a triangle,
- Use the getPerimeter() function to retrieve the perimeter of the triangle,
- Display the perimeter of the triangle
Write a function called getArea() that takes two parameters/arguments corresponding to the length of the base and of the height of a triangle.
Your function should calculate and return the area of this triangle.
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the length of the base and height of a triangle,
- Use the getArea() function to retrieve the area of the triangle,
- Display the area of the triangle
Write a function called getAngle() that takes two parameters/arguments called angle1 and angle2 (the value of two angles in degrees)
Your function should calculate and return the value of the third angle: (180 – angle1 – angle2)
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the value of two angles in degrees,
- Use the getAngle() function to retrieve the value of the third angle,
- Display this value on screen.
Write a function called isEquilateral() that takes three parameters a, b, c (the length of each side of a triangle).
Your function should workout if the triangle is equilateral (if all sides have the same length) and return a Boolean value (True or False) based on its finding.
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the length of the 3 sides of a triangle,
- Use the isEquilateral() function to find out if the triangle is an equilateral triangle,
- Display a relevant message to the end user.
Write a function called isIsoscles() that takes three parameters a, b, c (the length of each side of a triangle).
Your function should workout if the triangle is an isosceles triangle (if any two sides have the same length) and return a Boolean value (True or False) based on its finding.
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the length of the 3 sides of a triangle,
- Use the isIsoscles() function to find out if the triangle is an isosceles triangle,
- Display a relevant message to the end user.
Write a function called getHypotenuse() that takes two parameters/arguments called a and b (the length of two sides of a right-angled triangle).
Your function should calculate and return the length of the third side (the hypotenuse) of the triangle knowing that:

Write an algorithm to test your function. Your algorithm should:
- Ask the user to enter the length of the 2 sides of a right-angled triangle,
- Use the getyHypotenuse() function to retrieve the value of the hypotenuse of the right–angled triangle,
- Display the value of the Hypotenuse.
Write a function called isRightAngledTriangle(), that takes three parameters a, b and c and works out if the triangle is a right-angled triangle or not. Your function should return a Boolean value (True or False) based on its finding.
Write an algorithm to test your function. Your algorithm should:
- Ask the user to enter the length of the 3 sides of a triangle,
- Use the isRightAngledTriangle() function to find out if the triangle is a right-angled trinagle,
- Display a relevant message to the end-user.

Write a function called getTriangleArea() that takes three parameters/arguments a, b, c (the length of each side of a triangle).
Your function will apply Heron’s formula to calculate and return the area of the triangle.
Write an algorithm to test your function.
Your algorithm should:
- Ask the user to enter the length of the 3 sides of a triangle,
- Use the getTriangleArea() function to retrieve the area of the triangle,
- Display the area of the triangle
Python Code
We have already started the code for you and have completed the function getPerimeter() followed by a short algorithm to test this function.
Your task is to complete this Python script to create and test all the functions mentioned above.

Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area








suspects.csv
The first gemstone is an intense red ruby which was exposed in the main lounge.
The second stone is the world largest blue sapphire. It was stolen from the dining room.
This rare semi-translucent Onyx was exposed in the billiard room. A long blond hair has been found just next to the stand where the Onyx was displayed. The length of the hair suggests a female robber.
This clear topaz was exposed in the centre of the ballroom. A candle from the main chandelier was found on the floor. This would suggest that, while leaving the room in the dark, the robber inadvertently hit the chandelier. This means that the robber must be at least 1.85m tall.
The diamond was exposed in the library. A post-it note was found on the floor and one can assume it fell off the robber’s pocket or handbag. Some handwritten symbols appear on the post-it note but these are written using the Mandarin alphabet.
The tanzanite was exposed in the small lounge/tearoom.
The pink sapphire was exposed on the upstairs landing area. On their way out, the robber must have fallen down the stairs, as the guests reported hearing a loud noise. They also heard someone swear in English. The robber dropped their “Exposition information pack” which was given to all guests. In this pack an extra vegan menu page was found. This page is only given to guests with a vegan diet.
The quartz was exposed in the kitchen.
The emerald was exposed in the study room. It would seem that the burglar had to force the window open to escape the room. An earring in the shape of the Eiffel Tower was found at the scene. It is believed to belong to a French female guest.
The amber was exposed in the main hall. A flower pot was knocked over during the robbery and the soil from the pot spread over the carpet. The robber walked over it and left a footprint on their way out. It appeared to be woman’s shoe with a size between 6 and 7.
The peridot was exposed in the master bedroom. When the guests arrived at the scene, they could smell a subtle scent of jasmine, an essence used in women’s perfumes.
The amethyst was exposed in the royal suite.










Let’s look at the code for our main program. You may remember that in the first tutorial we talked about the main program loop. The first section of this loop is to respond to events such as user interactions when the user uses the mouse or the keyboard.


