Problem 5: Average Difference (100 pts)
Let's try to find the average absolute difference between every person's favorite number number
and their guess at the smallest number anyone will put, smallest
, rounded to the closest number.
For example, suppose two students put the following:
| number | smallest |
| ------ | -------- |
| 10 | 1 |
| 2 | 3 |
Then, average absolute difference is (abs(10-1) + abs(2-3)) / 2 = 5.0.
Create a table that contains one row with one value, the rounded value of the average absolute difference between every person's favorite number and their guess at the smallest value.
Hints:
abs
is asqlite3
function that returns the absolute value of the argument.round
is a function that rounds the value of the argument.avg
is a function that returns the average value in a set.
CREATE TABLE avg_difference AS
SELECT "REPLACE THIS LINE WITH YOUR SOLUTION";