fitness_center
Exercise 1.3
Unit Converter
Level 1
Chapter 1: Python Setup for Petroleum EngineeringdescriptionProblem
Convert these oilfield values to SI units and store each result in the indicated variable:
- Pressure: 4,800 psi → kPa (1 psi = 6.89476 kPa) →
p_kpa - Depth: 9,200 ft → m (1 ft = 0.3048 m) →
depth_m - Volume: 15,000 bbl → m³ (1 bbl = 0.158987 m³) →
vol_m3 - Density: 11.6 ppg → kg/m³ (1 ppg = 119.826 kg/m³) →
rho_kgm3 - API gravity: 35° API → specific gravity using
→ sg. Verify your result is approximately 0.8498.
Bonus. Convert the specific gravity back to API using and store it in api_back. Confirm you recover the original 35° within rounding tolerance.
lightbulbHints (0/4)
Stuck? Reveal hints one at a time — they progress from nudge to near-solution.
codeYour solution
main.py
visibilityReveal reference solutionexpand_more
Try solving it yourself first — the hints walk you through it. The solution below is one valid approach; yours may differ and still be correct.
p_kpa = 4800 * 6.89476
depth_m = 9200 * 0.3048
vol_m3 = 15000 * 0.158987
rho_kgm3 = 11.6 * 119.826
sg = 141.5 / (35 + 131.5)
api_back = 141.5 / sg - 131.5
print(f"4800 psi = {p_kpa:.1f} kPa")
print(f"9200 ft = {depth_m:.2f} m")
print(f"15000 bbl = {vol_m3:.2f} m^3")
print(f"11.6 ppg = {rho_kgm3:.2f} kg/m^3")
print(f"35 API = {sg:.4f} SG")
print(f"SG → API = {api_back:.4f} (should be 35)")
lockCopying code is a Full Access feature.