Skip to content
Exercises · Q18

Q.The volume of a sphere with radius r is 4/3πr³. Write a Python program to find the volume of spheres with radius 7cm, 12cm, 16cm, respectively.

Tripura TbseTextbookSubjective· 3mImportance★★★★★est
92% · 45/49 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Compute volume = (4/3) * math.pi * r**3 for r = 7, 12, 16 — giving about 1436.76, 7238.23 and 17157.28 cubic cm respectively.

The concept is translating the formula V = 4/3 πr³ into Python: the exponent operator ** for r³, math.pi for an accurate π, and — crucially — writing the fraction as 4/3 (which in Python 3 is true division, 1.333…, not the 1 that integer division would give in some other languages).

# Volume of spheres of radius 7, 12 and 16 cm
import math

for r in (7, 12, 16):
    volume = (4/3) * math.pi * r**3
    print("Radius:", r, "cm  Volume:", round(volume, 2), "cubic cm")

Key lines:

  • r**3 — precedence: ** binds before *, so the cube is computed first, exactly as the formula wants.
  • math.pi (≈ 3.141592653589793) beats typing 3.14 — the book's own answers differ at the decimals if a truncated π is used.
  • The loop avoids writing the same formula three times.

Working, step by step:

rr³(4/3)·r³× π → volume (rounded)
7343457.33…1436.76 cm³
12172823047238.23 cm³

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.