← back to unit
Medium
# breaking it down medium
Plan the Road Trip
Family road trip! Mom wants numbers before anyone touches the snacks. 🚗
You get the distance (km), the speed (km per hour), how many km the car squeezes from one liter (kmpl), and the price of a liter. Everything divides evenly. Print two lines: hours <driving time> and fuel <fuel cost>.
Example:
Input: distance = 300, speed = 100, kmpl = 15, price = 2
Output:
hours 3
fuel 40
Driving time is 300 ÷ 100 = 3 hours. Fuel needed is 300 ÷ 15 = 20 liters, costing 20 × 2 = 40.
💡 need a hint?
brk-road-trip.py🔒 given lines are locked — write your code in between
loading...