1
00:00:04,710 --> 00:00:09,629
Alright, so let's talk more about testing this
program we've written. To test if our

2
00:00:09,629 --> 00:00:13,170
code works when only removing items
from the start of the list, what I'm

3
00:00:13,170 --> 00:00:19,769
going to do is copy lines one to two,
comment that out, then delete manually,

4
00:00:19,769 --> 00:00:24,150
the two outlying values from the end.
So I'm gonna come down and delete these

5
00:00:24,150 --> 00:00:30,820
two entries here. Run the program, and we
can see that that's also working.

6
00:00:30,820 --> 00:00:35,520
The next test is when there are only outlying values at the end of the list. So once

7
00:00:35,520 --> 00:00:42,320
again, I'm going to comment the list out,
paste in the list I copied originally,

8
00:00:42,320 --> 00:00:51,640
and delete the entries at the start - the
first two, four and five. Run the program,

9
00:00:51,640 --> 00:00:55,320
and you can see that that works as well.
Alright, so moving on. The next test is when

10
00:00:55,320 --> 00:01:00,880
there are no outlying values at all.
Same drill, I'm going to comment out those lines,

11
00:01:00,880 --> 00:01:04,760
paste in the original. Now I'm
going to remove the outlying values from

12
00:01:04,769 --> 00:01:13,830
the end, as well as the start. Run the
program again. There wasn't anything for

13
00:01:13,830 --> 00:01:18,720
the program to do and the list's
unchanged, so that test also passes.

14
00:01:18,720 --> 00:01:21,960
Alright, for the next test, what I'm going
to do is paste in a list that doesn't

15
00:01:21,960 --> 00:01:33,320
have any values in the range we want, and
obviously I need to comment out lines 7 and 8,  like so.

16
00:01:33,320 --> 00:01:39,320
Run the program, and we end
up with an empty list, which is correct.

17
00:01:39,320 --> 00:01:44,100
I'll digress briefly here. I said that an
empty list is correct, but that's only as

18
00:01:44,100 --> 00:01:48,630
far as our code's concerned. If we're
performing a statistical analysis and

19
00:01:48,630 --> 00:01:52,710
removed all, or most of the values from
your data, then something's obviously not

20
00:01:52,710 --> 00:01:58,180
right. Outlying values are ones that
deviate from the norm by an unacceptable amount.

21
00:01:58,180 --> 00:02:01,220
If most of your data is
classed as outlying, then you haven't

22
00:02:01,229 --> 00:02:06,390
identified outlying values correctly. Any
statisticians watching this video,

23
00:02:06,390 --> 00:02:09,759
will know that you should do something like
calculate the standard deviation.

24
00:02:09,759 --> 00:02:16,140
We'd then use some multiple of that in our
conditions, down here, on lines 18,

25
00:02:16,140 --> 00:02:18,500
as well as line 29.

26
00:02:18,510 --> 00:02:22,500
We'd subtract the multiple from the mean
to get the minimum value, and add it to

27
00:02:22,500 --> 00:02:27,180
the mean to get the maximum. So just to
be clear, this program isn't identifying

28
00:02:27,180 --> 00:02:32,129
the values to remove. We're focusing on
removing things from a list. The exact

29
00:02:32,129 --> 00:02:37,840
values to use in those two conditions,
should be calculated from the data set -

30
00:02:37,840 --> 00:02:43,340
and I'm talking about the code on line 29, as
well as the code on line 18. Even then

31
00:02:43,349 --> 00:02:47,640
though, you should only remove outlying
values after investigating the cause.

32
00:02:47,640 --> 00:02:51,800
In our imaginary scenario, we have
identified two machines that were broken

33
00:02:51,800 --> 00:02:56,099
and giving incorrect data. So scrolling
back up to here, if we're measuring

34
00:02:56,099 --> 00:02:59,970
the maximum speed of a new racing car,
for example, then clearly there's

35
00:02:59,970 --> 00:03:03,739
something wrong with our equipment. All
the values in that last set of data

36
00:03:03,740 --> 00:03:08,720
are significantly higher than the current
land speed record. Alright, so moving on,

37
00:03:08,720 --> 00:03:15,740
the final test now, is an empty list.
So let's comment that out, and what we

38
00:03:15,750 --> 00:03:20,280
want to do is simply type data equals
left and square brackets, giving us an

39
00:03:20,280 --> 00:03:23,910
empty list. What we're testing here is
that our code doesn't crash when we give

40
00:03:23,910 --> 00:03:30,540
it an empty data set. So if we run the
program, and we get an empty list. So

41
00:03:30,540 --> 00:03:34,349
that's correct and the program didn't
crash. If we pass an empty list into our

42
00:03:34,349 --> 00:03:39,239
code, we're getting an empty list back
out. Alright, so in the next video, we'll

43
00:03:39,240 --> 00:03:42,380
continue looking at some other things
that you can do with lists.

44
00:03:42,380 --> 00:03:48,320
We'll remove items with a list that isn't ordered. See
you in the next video.

