All problems

The Spread Check

easyPythonStatistics

Kestrel Precision machines bearing shells to a target diameter. A batch passes only if the shells came out consistent with each other, so quality control never looks at the average diameter — it looks at the spread, meaning the distance between the widest shell in the batch and the narrowest. A wide spread means the machine drifted part-way through the run, even if the average still looks healthy.

Task: Print the range of the batch — the distance between the largest measurement and the smallest.

Input

The first line holds one integer n, how many measurements follow. Each of the next n lines holds one measurement as a plain number, which may carry a decimal point. Measurements appear in the order they were taken off the machine, not in size order.

Output

One line holding the range as a positive number with exactly one digit after the decimal point. A batch whose shells are all identical has a range of 0.0.

Example:

Input:
4
9.5
10.2
9.8
10.9

Output:
1.4

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…