All problems

Each Sensor's Reading Spread

mediumPythonNumPy2D Statistics

Riverbend Supply's cold-store has several temperature sensors, and each one is checked four times a day. Maintenance is not interested in how warm a sensor ran but in how far it wandered: a sensor whose four readings sit almost on top of each other is healthy, while one that swung from 10 to 20 in a day is drifting and gets a service visit. The log holds one line per sensor with that sensor's four readings across it, in time order.

Task: Print how far each sensor wandered — the gap between its highest and its lowest reading — one sensor per line, in the order the sensors are listed.

Input

The first line holds a single integer n, the number of sensors. Each of the next n lines holds four readings separated by single spaces, in time order. Readings may carry decimals.

Output

n lines, one per sensor, each holding that sensor's gap with exactly one digit after the decimal point. The gap is never negative; a sensor that read the same figure four times prints as 0.0.

Example:

Input:
2
10 15 12 20
5 5 6 5

Output:
10.0
1.0

Sign in to solve this problem

Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.

Sign in

Discussion

Sign in to join the discussion — reading is open to everyone.

Loading comments…