Write a function named circumference to calculate the circumference of the circle , which will not receive any value from the caller program but return circumference to the caller program.
Answers
Answer:
hope it helps you mate
Explanation:
The task is to illustrate a method that does not contain any parameter but should return some value. Methods are used to break a complete program into a number of modules that can be executed one by one. Considering any random shape to illustrate: Circle
Example: First a class named ‘Circle’ is supposed to be created, then with the help of this class, it can calculate the area and circumference of a circle.
1. Area calculation
2. Circumference calculation
In side the class Circle, we will declare a variable called radius to take the value of the radius from the user so that by using this value of radius we will be able to calculate the area and circumference of a circle. Now, for calculating the area and circumference, we need to create two separate methods called area() and circumference(), which does not take any value as a parameter but will definitely return some value, and the value which this method will return are the final values of area and circumference of the circle. The methods will return the values after calculating it with the help of the values of variables. The most important thing to calculate the area and circumference, and to use these methods are first to need is to call those methods which are known as calling a function, for this we have to create an object of Circle class because in the main method, and we want to access them, methods of another class hence we need to make the object of that class which contains our methods area() and circumference() and by using the object of the class Circle, we will easily call the methods and those methods will return some value, and we will display it by using our predefined function.
def circumfrence():
x= float(input("Enter the circumfrence: "))
return x