In what concerns the continuous evaluation solving exercises grade during the semester, you should submit until 23:59 of October 26th
(this exercise will still be available for submission after that deadline, but without couting towards your grade)
[to understand the context of this problem, you should read the class #03 exercise sheet]
Understanding the properties of circles is essential in geometry. In this exercise, you will help users calculate various attributes of a circle based on its radius.
Write a program that allows users to choose one of three options to calculate a property of a circle based on the given radius r. Use math.pi
in your calculations.
Option | Calculation |
---|---|
1 | Calculate the diameter of the circle. |
2 | Calculate the perimeter of the circle. |
3 | Calculate the area of the circle. |
"Invalid Option."
The input contains two lines:
The output should display the calculated property of the circle rounded to two decimal places, according to the specified option. Either one of the following:
"Diameter: [value]"
"Perimeter: [value]"
"Area: [value]"
"Invalid Option."
The following limits are guaranteed in all the test cases that will be given to your program:
menu: "1", "2", "3", other (invalid) | Menu options | |
0 < r ≤ 100 | Range of radius |
Example Input 1 | Example Output 1 |
1 2.5437 |
Diameter: 5.09 |
Example Input 2 | Example Output 2 |
5 2.5437 |
Invalid Option. |