Largest cone that can be inscribed within a cube | Python 3 Program to find the biggest cone inscribed within a cube ; Function to find the radius of the cone ; side cannot be negative ; radius of the cone ; Function to find the height of the cone ; side cannot be negative ; height of the cone ; Driver code
import math NEW_LINE def coneRadius ( a ) : NEW_LINE INDENT if ( a < 0 ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT r = a / math . sqrt ( 2 ) NEW_LINE return r NEW_LINE DEDENT def coneHeight ( a ) : NEW_LINE INDENT if ( a < 0 ) : NEW_LINE INDENT return - 1 NEW_LINE DEDENT h = a NEW_LINE return h NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT a = 6 NEW_LINE print ( " r ▁ = ▁ " , coneRadius ( a ) , " h ▁ = ▁ " , coneHeight ( a ) ) NEW_LINE DEDENT