Python Programming - Objects - Discussion

Discussion Forum : Objects - General Questions (Q.No. 23)
23.
Consider the following Python code:
class Circle:
    def __init__(self, radius):
        self.radius = radius

    def calculate_circumference(self):
        return 2 * 3.14 * self.radius
If you create an instance of the `Circle` class called small_circle with a radius of 2, what will be the result of calling small_circle.calculate_circumference()?
6.28
12.56
18.84
25.12
Answer: Option
Explanation:
The calculate_circumference method calculates the circumference of the circle using the formula 2 * 3.14 * radius. For the given instance, it would be 2 * 3.14 * 2 = 12.56.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.