{"id":22998,"date":"2021-09-29T20:13:04","date_gmt":"2021-09-29T14:43:04","guid":{"rendered":"https:\/\/python-programs.com\/?p=22998"},"modified":"2021-11-22T18:35:37","modified_gmt":"2021-11-22T13:05:37","slug":"python-program-to-calculate-volume-of-dodecahedron","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-calculate-volume-of-dodecahedron\/","title":{"rendered":"Python Program to Calculate Volume of Dodecahedron"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Calculate Area and Perimeter of Equilateral Triangle<\/a> Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to calculate the volume of the given Dodecahedron\u00a0 in Python:<\/p>\n Volume = (15 + 7\u221a5)*s3<\/sup>\/4\u00a0 where s is the side of the Dodecahedron<\/p><\/blockquote>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Practice Python Program Examples<\/a> to master coding skills and learn the fundamental concepts in the dynamic programming language Python.<\/p>\n In the previous article, we have discussed Python Program to Calculate Area and Perimeter of Equilateral Triangle Given a side of a Dodecahedron, the task is to find the volume of the Dodecahedron in Python. Examples: Example1: Input: Given Side = 5 Output: The Volume of the Dodecahedron with side { 5 } is = …<\/p>\n
\nGiven a side of a Dodecahedron, the task is to find the volume of the Dodecahedron in Python.<\/p>\nGiven Side = 5<\/pre>\n
The Volume of the Dodecahedron with side { 5 } is = 957.8898700780791<\/pre>\n
Given Side = 8<\/pre>\n
The Volume of the Dodecahedron with side { 8 } is = 3923.5169078398117<\/pre>\n
Program to Calculate Volume of Dodecahedron in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Import the math module using the math keyword.\r\nimport math\r\n# Give the side of the Dodecahedron as static input and store it in a variable.\r\nsideval = 5\r\n# Calculate the volume of the Dodecahedron using the above mathematical formula\r\n# ( (15 + 7\u221a5)*s3\/4).\r\n# We Calculate the \u221a5\u00a0in the above formula using the sqrt() function.\r\n# We can calculate the s^3\u00a0using the pow() function or '**' operator.\r\n# By using the above functions we calculate the volume of the Dodecahedron\r\n# and store it in a variable say volDode.\r\nvolDode = (((15 + (7 * (math.sqrt(5)))) \/ 4) * (math.pow(sideval, 3)))\r\n# Print the volDode\u00a0value.\r\nprint(\r\n 'The Volume of the Dodecahedron with side {', sideval, '} is = ', volDode)\r\n<\/pre>\n
The Volume of the Dodecahedron with side { 5 } is = 957.8898700780791<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Import the math module using the math keyword.\r\nimport math\r\n# Give the side of the Dodecahedron as user input using the int(input()) function\r\n# and store it in a variable.\r\nsideval = int(input('Enter some random side of Dodecahedron = '))\r\n# Calculate the volume of the Dodecahedron using the above mathematical formula\r\n# ( (15 + 7\u221a5)*s3\/4).\r\n# We Calculate the \u221a5\u00a0in the above formula using the sqrt() function.\r\n# We can calculate the s^3\u00a0using the pow() function or '**' operator.\r\n# By using the above functions we calculate the volume of the Dodecahedron\r\n# and store it in a variable say volDode.\r\nvolDode = (((15 + (7 * (math.sqrt(5)))) \/ 4) * (math.pow(sideval, 3)))\r\n# Print the volDode\u00a0value.\r\nprint(\r\n 'The Volume of the Dodecahedron with side {', sideval, '} is = ', volDode)\r\n<\/pre>\n
Enter some random side of Dodecahedron = 8\r\nThe Volume of the Dodecahedron with side { 8 } is = 3923.5169078398117<\/pre>\n
\n