Detecting a Skewed Distribution
Ashgrove Analytics files a weekly note on house sales in the Calder district. One runaway sale can drag the average miles away from anything an ordinary buyer paid, so the prices are banded into a picture that makes a long tail visible. Before the note goes out, the desk editor wants a flat yes or no underneath: is the average misleading this week?
Task: Print True when the average price and the middle price are more than 5 apart in either direction, and False otherwise. A gap of exactly 5 is not more than 5 and prints False. The middle price is the one in the centre once every price is put in order; when the count of prices is even, take the two central prices and use the point halfway between them.
Input
The first line holds an integer n, the number of sales. Each of the next n lines holds one price, possibly with decimals. n is at least 1.
Output
One line: exactly True or exactly False, capitalised as shown.
Example:
Input:
5
10
12
11
13
100
Output:
True
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