Python - Surface Area of an Icosahedron (20-sided Sphere)
by matt392 in Circuits > Software
38 Views, 1 Favorites, 0 Comments
Python - Surface Area of an Icosahedron (20-sided Sphere)

print ("This program will calculate the surface area of an icosahedron. ") import math # Formula for calculating the surface area of an icosahedron: # IcosahedronSurfaceArea = 5 * math.sqrt(3) * (edge**2) ########################################### # 1 function: solve for the surface area # math.sqrt(x) - returns square root of "x" # Function to solve for the surface area # Enter the length of the edge # IcosahedronSurfaceArea = 5 * math.sqrt(3) * (edge**2) def SolveForSurfaceAreaIcosahedron(): print ("Solving for the Surface Area of an Icosahedron.") # Square root function: math.sqrt(x) edge = float(input("Enter the length of the edge: ") ) SurfaceArea = (5 * math.sqrt(3)) * (edge**2) print("The surface area of the icosahedron is: ", SurfaceArea) ContinueCalculations = "y" # Check to see if the user wants to continue to calculate the surface area of an icosahedron while (ContinueCalculations=="y"): SolveForSurfaceAreaIcosahedron() ContinueCalculations = input("Would like to do another calculation for the the surface area of an icosahedron? (y/n): ") print("==================================") print ("Thank you to www.FxSolver.com for assistance with this formula.")