Areas Is PI
Areas Is PI
Circumference is 2 * PI * r
Python program to calculate the areas and circumference, code to measure area of a circle in python,
python code to compute areas of a circle;
We can code.
Def main () :
Import math
>>> pi = 3.14159
3.14159
‘3.14159’
The circumference of a circle is calculated by 2 pi, where pi =3.14159 (rounded to 5 decimals places).
Write a function called print- circum that takes an argument for the circle radius and print the circles.
First import the math module to access the value of pi. We define the print-circumference function that
takes the radius as an argument. Inside the function, we calculate the circumference using the formula 2
* pi and the store it in the circumference variable.
import math
math pi=3.14159
console .log (“The circumference of a circle with radius” + radius +” radius+ circumference”),
<|p>
Print-circumference (6);
Input: 6
37.69908
Input: 8.5
53.40703
Input: 9
56.54862
The first the function of the circle using the formula 2 pi r, where pi is approximated to 3.14159. We
then print out with the result using console.log ().
Using the formula 2 * pi * r, which is roughly equal to 3.14159 the first compute the circle’s
circumference with the print – circumference function. The output is then printed using console .log
37.69907999999999
Or
37.69908
When rounded to 5 decimal places according to the output of the print – circumference function when a
radius of 6 is specified.
Develop a catalog for a company.
self. items = {
“item 1 “: 10,
“item 2 “: 20,
“item 3 “: 30,
catalog = catalog ( )
print (10)
Get – price method returns the price of a single item, while the get – discounted – price method
calculates the discounted price based on the number of items purchased.
If the customer purchases a single item, the get – discounted – price method returns the regular price of
that item. If the customer purchase two items, the method calculates the total price of the items and
applies a 10% discount. If the customer purchases all three items, the method applies a 25% discount.
// total cost + = 10 + 20 + 30
If ((10 > 0 && 20 > 0 && 30 = == 0) // (10 > 0 && 30 > 0 && 20 = = = 0) // (20 > 0 && 30 >0 && 10 = = =
0))
The function takes three parameters, which represent the quality of each item being purchased. it first
calculations the total cost of the individual items. Then it checks if the customer is purchasing a combo
pack or a gift pack, or a gift pack and applies the appropriate discount to the total cost. It returns the
total after all discounts have been applied.