1
00:00:04,720 --> 00:00:08,080
Alright, so let's go through the
solution to the mini challenge, that I

2
00:00:08,080 --> 00:00:11,500
added at the end of the last video. And
how did you get on? Did you manage to

3
00:00:11,500 --> 00:00:17,420
complete it? The reality is, that adding a
new item involves far more work than it should.

4
00:00:17,420 --> 00:00:20,820
We have to make three changes to
the program, so let's go through and add

5
00:00:20,830 --> 00:00:25,090
the option to the menu first. So I'm
coming down and adding an option to

6
00:00:25,090 --> 00:00:30,980
option 6, down here, which is our hdmi
cable: print parentheses double quotes

7
00:00:30,980 --> 00:00:35,400
6 : hdmi cable, and we've got a double quote

8
00:00:35,410 --> 00:00:40,089
and a right parenthesis. Next, we have to
include a test for when the customer

9
00:00:40,089 --> 00:00:47,520
chooses item 6 - that'll be here. So we'll
add an elif there: elif current_choice

10
00:00:47,520 --> 00:00:52,960
is equal to - two equal signs - and
6 in single quotes and a colon.

11
00:00:52,960 --> 00:01:01,720
Then we'll do a computer_parts.append and in parentheses, we're going to add hdmi cable.

12
00:01:01,720 --> 00:01:05,780
So that's the second change. The
program still won't work, though,

13
00:01:05,780 --> 00:01:10,720
and that's because - if we go back up to line
five here - we check that the choice is in 1,

14
00:01:10,720 --> 00:01:15,640
2, 3, 4, 5. If we were happy to lose line 6 -
the line that prints the choice being

15
00:01:15,640 --> 00:01:20,530
added - then we could delete line 5 as
well, but if we want to keep that print

16
00:01:20,530 --> 00:01:27,260
statement, we need to add 6 to the string,
on line 5. I'm going to do that.

17
00:01:27,260 --> 00:01:32,580
Let's test the program to make sure that we can add an hdmi cable. I'm gonna add another

18
00:01:32,590 --> 00:01:39,130
item first - a computer, adding one. Let's
do 6, adding hdmi cable. Let's exit the

19
00:01:39,130 --> 00:01:44,840
program now, and you can see we've now
got a computer and a hdmi cable.

20
00:01:44,840 --> 00:01:48,400
Alright, so that works, but I think you'd
agree it was much harder than it should

21
00:01:48,400 --> 00:01:52,880
have been. This code - the way it's been
coded - isn't very easy to maintain.

22
00:01:52,880 --> 00:01:56,320
So it would certainly be much neater if we
could just add new items to a list and

23
00:01:56,320 --> 00:02:01,510
have everything else just work. Can we do
that? Of course we can, and this is a good

24
00:02:01,510 --> 00:02:05,470
way to see how useful lists can be, and
we'll start improving our code to achieve

25
00:02:05,470 --> 00:02:08,970
that, in the next video.

