Problem 121412 · easy · Level 01 Prerequisites & Setup

Litres in a Cylindrical Tank

functions · geometry · rounding

A water tank is a cylinder with radius radius_cm and height height_cm, both in centimetres. Write tank_litres(radius_cm, height_cm) that returns how many whole litres it can hold (round down). One litre is 1000 cubic centimetres.

Examples

Input:  radius_cm = 50, height_cm = 100
Output: 785
Explanation: pi * 50² * 100 = 785398.16 cm³ = 785.39 L.

Input:  radius_cm = 10, height_cm = 10
Output: 3

Input:  radius_cm = 5, height_cm = 5
Output: 0

Constraints

  • 0 <= radius_cm, height_cm <= 1000; values may be ints or floats
  • Use math.pi; return an integer

Goals

  • Use the cylinder volume formula
  • Convert units and round down
Starting Python…