Circle Geometry Functions

In this challenge we will create a library of functions to apply the different formulas based on the geometry of circles.

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.

CircumferenceAreaArcSector: PerimeterSector: AreaChordSegment: PerimeterSegment: Area
circle-circumference
Write a function called getCircumference() that takes one parameter/argument: the radius of a circle.

Your function should calculate and return the circumference (perimeter) of this circle..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Use the getCircumference() function to retrieve the circumference of the circle,
  • Display the circumference of the circle
circle-area
Write a function called getArea() that takes one parameter/argument: the radius of a circle.

Your function should calculate and return the area of this circle..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Use the getArea() function to retrieve the area of the circle,
  • Display the area of the circle
circle-arc
Write a function called getArcLength() that takes two parameters/arguments: the radius and angle of an arc.

Your function should calculate and return the length of this arc..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of an arc,
  • Use the getArcLength() function to retrieve the length of this arc,
  • Display the length of the arc.
circle-sector-perimeter

Write a function called getSectorPerimeter() that takes two parameters/arguments: the radius and angle of a sector.

Your function should calculate and return the perimeter of this sector..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of a sector,
  • Use the getSectorPerimeter() function to retrieve the perimeter of this sector,
  • Display the perimeter of this sector.
circle-sector-area

Write a function called getSectorArea() that takes two parameters/arguments: the radius and angle of a sector.

Your function should calculate and return the area of this sector..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of a sector,
  • Use the getSectorArea() function to retrieve the area of this sector,
  • Display the area of this sector.
circle-chord
Write a function called getChordLength() that takes two parameters/arguments: the radius and angle of a chord.

Your function should calculate and return the length of this chord..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of a chord,
  • Use the getChordLength() function to retrieve the lenght of the chord,
  • Display the length of the chord
circle-segment-perimeter

Write a function called getSegmentPerimeter() that takes two parameters/arguments: the radius and angle of a segment.

Your function should calculate and return the area of this segment..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of a segment,
  • Use the getSegmentPerimeter() function to retrieve the perimeter of this segment,
  • Display the perimeter of the segment
circle-segment-area

Write a function called getSegmentArea() that takes two parameters/arguments: the radius and angle of a segment.

Your function should calculate and return the area of this segment..


Write an algorithm to test your function.
Your algorithm should:

  • Ask the user to enter the length of the radius of a circle,
  • Ask the user to enter the angle of a segment,
  • Use the getSegmentArea() function to retrieve the area of this segment,
  • Display the area of the segment

Python Code


We have already started the code for you and have completed the function getCircumference() 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.

Did you like this challenge?

Click on a star to rate it!

Average rating 4.3 / 5. Vote count: 40

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: ,