Largest right circular cone that can be inscribed within a sphere | Python 3 Program to find the biggest cone that can be inscribed within a sphere ; Function to find the radius of the cone ; radius 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 coner ( R ) : NEW_LINE INDENT if ( R < 0 ) : NEW_LINE INDENT return - 1 ; NEW_LINE DEDENT r = ( 2 * math . sqrt ( 2 ) * R ) / 3 NEW_LINE return float ( r ) NEW_LINE DEDENT def coneh ( R ) : NEW_LINE INDENT if ( R < 0 ) : NEW_LINE INDENT return - 1 ; NEW_LINE DEDENT h = ( 4 * R ) / 3 NEW_LINE return float ( h ) NEW_LINE DEDENT R = 10 NEW_LINE print ( " r ▁ = ▁ " , coner ( R ) , " , ▁ " , " h ▁ = ▁ " , coneh ( R ) ) NEW_LINE