-2

In the formula for calculating the volume of a sphere, the radius is raised to the power of 3. So, if I assign a variable such as sphere_radius to the radius, how would I raise that variable to the power of 3 (in shorthand form without having to multiply the radius three times) in my python statement to calculate the volume?

1 Answers1

0

In python, a**b will raise a to the power of b.

For example:

cubed = radius ** 3
KingsDev
  • 654
  • 5
  • 21