You will write functions for three kinds of questions from this course: how many small balls a solid makes, how long a wire is, and how long a pipe takes to fill a tank.
The idea. When a solid is melted and recast, the volume stays the same. Water from a pipe in one second is a cylinder with the pipe's radius and a length equal to the speed.
Your tasks.
balls_from, return the whole number of balls of radius ball that can be made from a solid of volume volume.wire_length, return the length of the wire that a ball of radius ball makes when it is drawn into a wire of radius wire. Both radii are in the same unit.fill_time, return the time in seconds to fill a tank. The pipe radius is in metres, the speed is in metres per second and the tank volume is in cubic metres.water_rise, return the rise in a cylinder of radius jar when a ball of radius ball sinks in it.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…