MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / main

Function main

maths/volume.py:543–563  ·  view source on GitHub ↗

Print the Results of Various Volume Calculations.

()

Source from the content-addressed store, hash-verified

541
542
543def main():
544 """Print the Results of Various Volume Calculations."""
545 print("Volumes:")
546 print(f"Cube: {vol_cube(2) = }") # = 8
547 print(f"Cuboid: {vol_cuboid(2, 2, 2) = }") # = 8
548 print(f"Cone: {vol_cone(2, 2) = }") # ~= 1.33
549 print(f"Right Circular Cone: {vol_right_circ_cone(2, 2) = }") # ~= 8.38
550 print(f"Prism: {vol_prism(2, 2) = }") # = 4
551 print(f"Pyramid: {vol_pyramid(2, 2) = }") # ~= 1.33
552 print(f"Sphere: {vol_sphere(2) = }") # ~= 33.5
553 print(f"Hemisphere: {vol_hemisphere(2) = }") # ~= 16.75
554 print(f"Circular Cylinder: {vol_circular_cylinder(2, 2) = }") # ~= 25.1
555 print(f"Torus: {vol_torus(2, 2) = }") # ~= 157.9
556 print(f"Conical Frustum: {vol_conical_frustum(2, 2, 4) = }") # ~= 58.6
557 print(f"Spherical cap: {vol_spherical_cap(1, 2) = }") # ~= 5.24
558 print(f"Spheres intersection: {vol_spheres_intersect(2, 2, 1) = }") # ~= 21.21
559 print(f"Spheres union: {vol_spheres_union(2, 2, 1) = }") # ~= 45.81
560 print(
561 f"Hollow Circular Cylinder: {vol_hollow_circular_cylinder(1, 2, 3) = }"
562 ) # ~= 28.3
563 print(f"Icosahedron: {vol_icosahedron(2.5) = }") # ~=34.09
564
565
566if __name__ == "__main__":

Callers 1

volume.pyFile · 0.70

Calls 15

vol_cubeFunction · 0.85
vol_cuboidFunction · 0.85
vol_coneFunction · 0.85
vol_right_circ_coneFunction · 0.85
vol_prismFunction · 0.85
vol_pyramidFunction · 0.85
vol_sphereFunction · 0.85
vol_hemisphereFunction · 0.85
vol_circular_cylinderFunction · 0.85
vol_torusFunction · 0.85
vol_conical_frustumFunction · 0.85
vol_spherical_capFunction · 0.85

Tested by

no test coverage detected