Computer Science, asked by nikhilkumar4567b94, 2 days ago

write a python program to find the volume of a sphere with radius 8.5 CM​

Answers

Answered by anindyaadhikari13
3

\texttt{\textsf{\large{\underline{Hint.!}}}}

\tt \mapsto Volume\ Of\ Sphere = \dfrac{4}{3}\pi r^{3}

Substitute the value of r in the expression to calculate volume.

\texttt{\textsf{\large{\underline{The C{o}de}:}}}

from math import pi

radius = 8.5

volume = round(4/3 * pi * radius *‎* 3,2)

print('Volume of the sphere with radius',radius,'cm is:',volume,'cubic cm.')

\texttt{\textsf{\large{\underline{Explanation}:}}}

  • Math module contains the value of pi (constant).
  • Here, we have imported the value of pi from math module. Then, we have calculated the volume of the sphere using formula.
  • The volume of the sphere is then rounded off to 2 decimal places and it is displayed on the screen.

See attachment for output.

Attachments:
Similar questions