1
00:00:04,900 --> 00:00:06,580
So just before we get
started with dictionaries.

2
00:00:06,580 --> 00:00:09,440
I just wanted to give you a bit more of
an overview of what we're trying to do in

3
00:00:09,440 --> 00:00:12,200
this section with sets and dictionaries.

4
00:00:12,200 --> 00:00:15,830
So in previous sections we've seen how
lists can be used to store lists of

5
00:00:15,830 --> 00:00:18,940
objects, and then we can actually
retrieve those objects by their index.

6
00:00:18,940 --> 00:00:21,010
Which is of course the position.

7
00:00:21,010 --> 00:00:21,850
In the list.

8
00:00:21,850 --> 00:00:24,990
In lists it generally used
to store similar items.

9
00:00:24,990 --> 00:00:26,190
Although you can store numbers and

10
00:00:26,190 --> 00:00:29,550
strings in the same list if you can
think of a good reason for doing so.

11
00:00:29,550 --> 00:00:34,410
Now lists are also ordered sequences so
as a result you can interact through

12
00:00:34,410 --> 00:00:36,660
all the items on the list and
process them in order.

13
00:00:36,660 --> 00:00:39,360
And of course,
we've done that in previous videos.

14
00:00:39,360 --> 00:00:42,560
So in this section, we're going to
look at dictionaries and sets, and

15
00:00:42,560 --> 00:00:45,070
they're both actually
unordered collections.

16
00:00:45,070 --> 00:00:49,850
They both also guarantee that there will
be no duplicates in that collection.

17
00:00:49,850 --> 00:00:54,250
Sets as similar to lists in that they're
actually intended for storing similar

18
00:00:54,250 --> 00:00:59,930
items But you can't actually access
individual items using an index.

19
00:00:59,930 --> 00:01:04,660
The set is unordered, so an index is
meaningless in the context of a set.

20
00:01:04,660 --> 00:01:07,390
You find out more information
about that when we get to

21
00:01:07,390 --> 00:01:09,860
the set videos in this section.

22
00:01:09,860 --> 00:01:12,990
So dictionaries on the other
hand Are again unordered and

23
00:01:12,990 --> 00:01:15,120
I can take key valued pairs.

24
00:01:15,120 --> 00:01:19,580
Now the values again are not accessed
by an index but by means of a key.

25
00:01:19,580 --> 00:01:23,190
So that's part and
parcel of discussing dictionaries.

26
00:01:23,190 --> 00:01:26,730
It's gonna give us a good opportunity
to introduce two new string methods,

27
00:01:26,730 --> 00:01:28,330
not only the split end joint.

28
00:01:28,330 --> 00:01:29,650
So let's get into dictionaries.

29
00:01:29,650 --> 00:01:32,620
So as I mentioned,
dictionaries aren't axis point index, but

30
00:01:32,620 --> 00:01:35,600
they're accessed instead
by means of a key.

31
00:01:35,600 --> 00:01:39,370
Probably the best way to give you more
information about this is to show

32
00:01:39,370 --> 00:01:39,950
you an example.

33
00:01:39,950 --> 00:01:46,270
I'm going to start typing and
we'll start with fruit equals orange.

34
00:01:46,270 --> 00:01:52,950
A sweet orange citrus Fruit.

35
00:01:56,070 --> 00:01:57,390
Apple.

36
00:01:57,390 --> 00:02:02,610
Where I'm putting the colon,
good for making cider.

37
00:02:02,610 --> 00:02:07,210
Lemon:a sour

38
00:02:07,210 --> 00:02:12,770
yellow Citrus fruit.

39
00:02:14,600 --> 00:02:15,280
We'll do a couple more.

40
00:02:15,280 --> 00:02:21,140
Grape, a small sweet

41
00:02:21,140 --> 00:02:25,010
fruit growing in bunches.

42
00:02:27,500 --> 00:02:29,630
And the last one let's do lime.

43
00:02:29,630 --> 00:02:34,930
[SOUND]
Sour,

44
00:02:34,930 --> 00:02:41,460
green, citrus, fruit.

45
00:02:41,460 --> 00:02:45,050
And so if I do a print fruit and
run that first.

46
00:02:49,780 --> 00:02:54,320
So no real surprises there, it's just
duplicated what we've typing effectively.

47
00:02:54,320 --> 00:03:00,120
But what we can do to access a particular
element, we can type print fruit,

48
00:03:01,980 --> 00:03:05,890
remember we can't use an index number but
we can use the key.

49
00:03:05,890 --> 00:03:08,140
So we can type lemon for argument's sake.

50
00:03:08,140 --> 00:03:12,110
Noting that IntelliJ is automatically
telling us the elements as we're

51
00:03:12,110 --> 00:03:15,300
typing it, so Apple grape or

52
00:03:15,300 --> 00:03:19,010
stopping typing something [INAUDIBLE] so
it's pretty smart.

53
00:03:19,010 --> 00:03:22,130
Looking at the dictionary
giving some options.

54
00:03:22,130 --> 00:03:25,630
Type lemon there we run this.

55
00:03:27,920 --> 00:03:29,950
We get a sour yellow citrus fruit.

56
00:03:31,840 --> 00:03:35,850
So the key is lemon, and
the description of the information,

57
00:03:35,850 --> 00:03:40,260
the value in other words,
is a sour yellow citrus fruit for lemon.

58
00:03:40,260 --> 00:03:43,640
So as you can see we can access
individual items by their key by typing,

59
00:03:43,640 --> 00:03:44,920
in this case, lemon, And

60
00:03:44,920 --> 00:03:48,790
in terms of entering them, you can say
that we enter a list of keys and valleys.

61
00:03:48,790 --> 00:03:50,810
And the key is separated by a colon.

62
00:03:50,810 --> 00:03:52,160
Not a comma so it's the key.

63
00:03:52,160 --> 00:03:55,980
You can see the orange, apple or lemon,
grape and lime in the keys colon.

64
00:03:55,980 --> 00:03:58,790
And then there's the description or
the value.

65
00:03:58,790 --> 00:04:01,650
Which is what is associated
with that particular key.

66
00:04:01,650 --> 00:04:04,010
And again,
we can access individual keys and

67
00:04:04,010 --> 00:04:07,030
individual values by the keys which
you saw me do on the screen there.

68
00:04:07,030 --> 00:04:09,260
And probably now looking at this,

69
00:04:09,260 --> 00:04:11,950
you can see that it's easy to see
why they are called dictionaries.

70
00:04:11,950 --> 00:04:14,850
And you could use one to store a list
of words in their definitions for

71
00:04:14,850 --> 00:04:15,460
argument sake.

72
00:04:15,460 --> 00:04:19,120
And you can also use a dictionary to store
different types of information And then

73
00:04:19,120 --> 00:04:22,450
this example I'm about to type in we're
gonna store information about a motorboat.

74
00:04:22,450 --> 00:04:24,840
And what we're gonna do is we're
gonna create a new file for

75
00:04:24,840 --> 00:04:27,580
this because we're gonna be coming
back to the fruit later in the video.

76
00:04:27,580 --> 00:04:29,240
So I'm doing file>new.

77
00:04:29,240 --> 00:04:32,390
Just making sure that's selected up here.

78
00:04:32,390 --> 00:04:37,800
Project file>new Python, and
we'll call this one motorbike, and

79
00:04:37,800 --> 00:04:44,250
for this one I'm going to paste in
a bit of code to save a bit of time.

80
00:04:44,250 --> 00:04:45,750
So you can see what I've done there.

81
00:04:45,750 --> 00:04:50,760
I've got the make as a key, the model
as a key, the color as a key, and

82
00:04:50,760 --> 00:04:53,900
the engine size as a key, and
the value as you can see Honda.

83
00:04:53,900 --> 00:04:58,730
250 dream, color is red and
engine size is 250 19.

84
00:04:58,730 --> 00:05:01,400
Now, that is a number and not a string.

85
00:05:01,400 --> 00:05:08,130
So, what we can do is then do a print,
bike, engine size, and

86
00:05:08,130 --> 00:05:13,770
again, intemijay is helping us there quite
helpfully Pointing out the particular key.

87
00:05:13,770 --> 00:05:17,550
And we go print bike color.

88
00:05:17,550 --> 00:05:20,540
And if we're running this, remember that
because we've got two files open now,

89
00:05:20,540 --> 00:05:23,420
we need to select over here
the relevant file we wanna run.

90
00:05:23,420 --> 00:05:24,320
So [INAUDIBLE] but

91
00:05:24,320 --> 00:05:27,710
that one will actually come up the first
time until we've run this at least once,

92
00:05:27,710 --> 00:05:31,620
or what we can do is right-click in here,
Making sure that we clicked into the right

93
00:05:31,620 --> 00:05:35,790
window, we can run motorbike and
you can see we get 250 and red.

94
00:05:35,790 --> 00:05:39,240
So the engine size correctly comes
back as 250 and the color is red.

95
00:05:39,240 --> 00:05:42,000
And now we'd be able to select both
options here, dictionary and motorbike,

96
00:05:42,000 --> 00:05:44,140
'cuz we've run them at least once.

97
00:05:44,140 --> 00:05:47,800
So as you can see here the values
themselves don't have to be the same type.

98
00:05:47,800 --> 00:05:49,940
So what we can do is we can
store the engine sizes and

99
00:05:49,940 --> 00:05:52,020
numbers that you saw in line one.

100
00:05:52,020 --> 00:05:55,620
And the good thing about it is that you're
not limited to strings and numbers.

101
00:05:55,620 --> 00:05:58,170
Values can be used with just
about any path or object.

102
00:05:58,170 --> 00:05:59,660
Even another dictionary.

103
00:05:59,660 --> 00:06:03,030
So this particular use of a dictionary
is like storing records about an object,

104
00:06:03,030 --> 00:06:04,610
in this case, a motorbike.

105
00:06:04,610 --> 00:06:07,150
And although we're storing
different types of data,

106
00:06:07,150 --> 00:06:09,450
they're all related to a common object.

107
00:06:09,450 --> 00:06:11,590
So the keys can be also
different types of object.

108
00:06:11,590 --> 00:06:14,840
The only restriction is that
they must be immutable.

109
00:06:14,840 --> 00:06:19,130
So we can't use a list for example as
a dictionary key but we can use as they

110
00:06:19,130 --> 00:06:23,860
are of course which we found out in
previous videos, so let's go back to our

111
00:06:23,860 --> 00:06:28,560
fruit, go back to our dictionaries.pie so
we can add to a dictionary.

112
00:06:28,560 --> 00:06:36,020
So what we can do is we could type
something like fruit, pear equals.

113
00:06:36,020 --> 00:06:42,250
An odd shaped apple.

114
00:06:42,250 --> 00:06:43,210
Print fruit.

115
00:06:43,210 --> 00:06:48,600
So if we do that run it make a drop
here by selecting the rock file this

116
00:06:48,600 --> 00:06:52,140
[INAUDIBLE] it's called dictionary because
that is what I called it and run it.

117
00:06:53,150 --> 00:06:53,830
We have a look now.

118
00:06:55,000 --> 00:06:56,620
When we can see pair is in here now.

119
00:06:56,620 --> 00:06:58,330
It's an odd shaped apple.

120
00:06:58,330 --> 00:07:01,520
So that's a way to add
an entry to the dictionary.

121
00:07:01,520 --> 00:07:05,700
And we need to do it that way because
unlike lists there's no method to insert

122
00:07:05,700 --> 00:07:07,450
or append items in a dictionary.

123
00:07:07,450 --> 00:07:10,710
As you can see what we did there we just
assigned a new value to the dictionary by

124
00:07:10,710 --> 00:07:12,140
specifying the new key.

125
00:07:12,140 --> 00:07:15,080
And giving it a value, and
the rest of it happens automatically.

126
00:07:15,080 --> 00:07:18,490
Now, whether accessing a value or
adding a new entry, square brackets

127
00:07:18,490 --> 00:07:22,240
are used after the dictionary name to
enclose the key, as you can see there.

128
00:07:22,240 --> 00:07:25,160
So, in other words, if we're
printing it out, The case on line 8.

129
00:07:25,160 --> 00:07:27,610
We're selecting the value
that we want to print out or

130
00:07:27,610 --> 00:07:32,420
we're creating a new entry we need to put
the key in both cases in square brackets.

131
00:07:32,420 --> 00:07:36,870
The other thing that we mentioned was
the keys in the dictionary are unique.

132
00:07:36,870 --> 00:07:41,240
So if we assign a value to an existing
key you end up producing the value

133
00:07:41,240 --> 00:07:44,100
Rather than adding another entry so
it's really important to understand that.

134
00:07:44,100 --> 00:07:48,610
So,again if you assign a value
to an existing key we end up

135
00:07:48,610 --> 00:07:52,790
replacing the value rather than creating
another entry or adding another entry.

136
00:07:52,790 --> 00:08:00,950
So, going back to that [INAUDIBLE] that's
working we can talk fruit, pear, equals.

137
00:08:00,950 --> 00:08:05,950
Great with tequila,

138
00:08:05,950 --> 00:08:09,580
print fruit, if we run that.

139
00:08:11,100 --> 00:08:12,010
You can see we've got pear,

140
00:08:12,010 --> 00:08:16,390
an odd shaped apple, pear, great with
tequila at second time we ran it.

141
00:08:16,390 --> 00:08:19,230
We actually over wrote the entry,
there's not two entries for pear in there,

142
00:08:19,230 --> 00:08:20,070
there's only the one.

143
00:08:20,070 --> 00:08:24,940
So there's one key but now there's now
an updated value, great with tequila.

144
00:08:26,040 --> 00:08:29,740
I'll just fix that typo
now that I've seen it.

145
00:08:29,740 --> 00:08:33,020
And probably being more realistic,
fruit lime is great with tequila.

146
00:08:33,020 --> 00:08:34,890
I'm not too sure that pear is.

147
00:08:34,890 --> 00:08:36,309
So again, the same example there.

148
00:08:36,309 --> 00:08:39,690
Lime has been updated, as you can see on
the screen, to be great with tequila.

149
00:08:40,730 --> 00:08:44,370
Now there's nothing to stop you for
reusing a key when you initially create

150
00:08:44,370 --> 00:08:47,500
the dictionary and python won't
actually give you an error, but

151
00:08:47,500 --> 00:08:51,320
the behavior will be the same as
assigning a new value to an existing key.

152
00:08:51,320 --> 00:08:54,880
So the entry that appears last in
the list is the one that will appear

153
00:08:54,880 --> 00:08:58,050
In your dictionary and what i mean
by that i come down here i can put

154
00:09:00,250 --> 00:09:05,510
apple even though we got it found
on line two we can find it again

155
00:09:05,510 --> 00:09:11,260
[INAUDIBLE] [INAUDIBLE] [INAUDIBLE]
You see when we run it,

156
00:09:11,260 --> 00:09:15,830
you see apple has come around and crunchy

157
00:09:17,260 --> 00:09:21,510
That was the last entry that was added
on line six which over-rode effectively

158
00:09:21,510 --> 00:09:26,060
the one on line two or to be more
precise it just updated the value.

159
00:09:26,060 --> 00:09:30,450
So the first time apple and the value
was created good for making cider but

160
00:09:30,450 --> 00:09:31,920
when you go to this entry.

161
00:09:31,920 --> 00:09:35,000
It just updated the value to be round and
crunchy.

162
00:09:35,000 --> 00:09:37,920
And note again that Python doesn't
give you an error there at all.

163
00:09:37,920 --> 00:09:41,060
But both and
Picham will actually give you a warning.

164
00:09:41,060 --> 00:09:43,040
So if we come up here,
it actually does tell you.

165
00:09:43,040 --> 00:09:45,590
It says dictionary contains
duplicate keys apple.

166
00:09:45,590 --> 00:09:49,110
So even though you saw there's
no Python error as such, and

167
00:09:49,110 --> 00:09:51,170
it doesn't crash the program or
anything like that,

168
00:09:51,170 --> 00:09:55,550
you will actually get a warning from or
Picham about that, which is pretty neat.

169
00:09:55,550 --> 00:09:58,460
And that's just another reason to
make sure you are checking these

170
00:09:58,460 --> 00:10:02,600
markers on a regular basis cuz it
will help you in your programming

171
00:10:02,600 --> 00:10:04,520
as we established in previous videos.

172
00:10:04,520 --> 00:10:07,610
Now before we have to look at some more
ways we can make use of a dictionary

173
00:10:07,610 --> 00:10:09,560
is a few more things
that we need to cover.

174
00:10:09,560 --> 00:10:13,150
That's always useful to be able
to remove items from collections.

175
00:10:13,150 --> 00:10:15,730
And to do that with a dictionary
use the del command.

176
00:10:15,730 --> 00:10:19,570
So down here, for example, if we wanted
to delete lemon type del then we

177
00:10:20,770 --> 00:10:23,530
enter the name of the key in brackets.

178
00:10:23,530 --> 00:10:27,000
So for example,
lemon would remove that item.

179
00:10:27,000 --> 00:10:32,850
So we can put a print under that
The last entry now when we run it,

180
00:10:32,850 --> 00:10:34,740
shouldn't have a lemon there.

181
00:10:34,740 --> 00:10:37,270
So we scroll this over,
you'll see we got lima, lemon, and

182
00:10:37,270 --> 00:10:40,460
then lemon has disappeared
from the last line of output,

183
00:10:40,460 --> 00:10:46,030
which was of the line of output that was
processed after We deleted it on line 14.

184
00:10:46,030 --> 00:10:49,730
Now the del command is a lot
more powerful than that example

185
00:10:49,730 --> 00:10:51,420
probably indicates on the screen.

186
00:10:51,420 --> 00:10:53,250
So make sure you use it with care.

187
00:10:53,250 --> 00:10:57,940
So if you forget to specify key to delete,
then it removes the entire dictionary and

188
00:10:57,940 --> 00:10:59,700
we therefore get an error
when we try to print fruit.

189
00:10:59,700 --> 00:11:05,130
So I went back here, commented that
out and just made that Del fruit.

190
00:11:06,270 --> 00:11:09,240
We should get an error on the last line
because the entire dictionary no longer

191
00:11:09,240 --> 00:11:10,480
exists because we've deleted it.

192
00:11:10,480 --> 00:11:13,520
And you can see name
three is not defined and

193
00:11:13,520 --> 00:11:16,560
it's because it not only totally
removed the contents of the dictionary,

194
00:11:16,560 --> 00:11:20,570
it deleted the variable incompletely,
and that's why we're getting that error.

195
00:11:20,570 --> 00:11:23,890
So, if you wanted to delete all
the entries in the dictionary but

196
00:11:23,890 --> 00:11:26,730
still wanted to retain the dictionary
like effectively an empty dictionary so

197
00:11:26,730 --> 00:11:29,730
you could start adding to later,
So, it doesn't count venera but

198
00:11:29,730 --> 00:11:32,480
you use something different
you use fruit dot clear.

199
00:11:32,480 --> 00:11:36,390
So, you type fruit dot clear like so.

200
00:11:36,390 --> 00:11:38,860
So, if we run that, and
fully error at this time and

201
00:11:38,860 --> 00:11:43,560
the contents have been deleted
effectively or cleared out.

202
00:11:43,560 --> 00:11:47,700
So, it's now empty waiting for you to
process or manipulate it some other way.

203
00:11:47,700 --> 00:11:51,260
So we now know how to create the
dictionary, we've added items to it, and

204
00:11:51,260 --> 00:11:54,350
we've removed a single item, and
we've also cleared the entire dictionary.

205
00:11:54,350 --> 00:11:57,680
And we've said one way to access the
individual item is by specifying the key,

206
00:11:57,680 --> 00:12:01,060
but one problem with
accessing items by key occurs

207
00:12:01,060 --> 00:12:04,300
when we try to retrieve
an item that doesn't exist.

208
00:12:04,300 --> 00:12:07,640
So if you delete lines, so what I'm gonna
do is just delete these lines here, so

209
00:12:07,640 --> 00:12:09,140
we have still got something to work with.

210
00:12:10,780 --> 00:12:14,730
Those it so we still got some
items in our dictionary so

211
00:12:14,730 --> 00:12:19,130
if we try to do a print to outside.

212
00:12:19,130 --> 00:12:24,200
Knowing that hasn't made it
into a cage it doesn't exist.

213
00:12:24,200 --> 00:12:28,200
>> [NOISE]
>> Plus you run that.

214
00:12:29,540 --> 00:12:30,540
Key error tomato.

215
00:12:30,540 --> 00:12:35,520
So it's basically saying the key doesn't
exist of key tomato doesn't exist

216
00:12:35,520 --> 00:12:36,410
in the dictionary.

217
00:12:36,410 --> 00:12:38,010
So this is something you may want to do.

218
00:12:38,010 --> 00:12:42,890
You may want to do some testing to check
if a particular key is in the dictionary.

219
00:12:42,890 --> 00:12:44,480
And unfortunately we can get around that.

220
00:12:44,480 --> 00:12:46,280
There's a couple of ways we can do it.

221
00:12:46,280 --> 00:12:50,620
What I'll do first is going to modify the
program slightly before reading the keys.

222
00:12:50,620 --> 00:12:51,450
So let's go back up here.

223
00:12:51,450 --> 00:12:54,210
I'm gonna remove the second entry
cuz we don't need that anymore.

224
00:12:54,210 --> 00:12:57,510
And I'm gonna comment out this code.

225
00:13:00,200 --> 00:13:05,260
And actually what I'll do is I'll
leave the last print in, print(fruit).

226
00:13:06,880 --> 00:13:12,410
And let's create some code that allows
you to type in the name of the fruit,

227
00:13:12,410 --> 00:13:14,880
and it will try and press us there.

228
00:13:14,880 --> 00:13:20,000
So, we can type while, true, we're gonna
try and look it up in the dictionary.

229
00:13:20,000 --> 00:13:22,970
We're gonna type dict_key,
dictionary key abbreviated.

230
00:13:22,970 --> 00:13:28,740
Equals input please enter a fruit.

231
00:13:32,030 --> 00:13:37,490
If the dictionary key is equal to quit,
we'll break.

232
00:13:39,010 --> 00:13:42,270
So, that just allows us to get out
of the loop, but failing that,

233
00:13:42,270 --> 00:13:47,470
it should mean that quit wasn't typed or
assigned description

234
00:13:47,470 --> 00:13:54,460
To be equal to fruit.get(dict), and
that is using the dict function.

235
00:13:54,460 --> 00:13:57,890
print(description).

236
00:13:57,890 --> 00:14:02,460
And if you run that and
we enter in something like grape,

237
00:14:03,850 --> 00:14:04,870
we get the answer to that.

238
00:14:04,870 --> 00:14:09,340
If we enter another one like apple,
And not in the amount

239
00:14:09,340 --> 00:14:13,490
that come up automatically quit
out of it makes it like so, So,

240
00:14:13,490 --> 00:14:16,730
again is saw out of dictionary
retrieves the value for

241
00:14:16,730 --> 00:14:20,570
specialized very similar to providing
the key to square brackets but

242
00:14:20,570 --> 00:14:23,670
the great thing is it doesn't give
an era if the key doesn't exist.

243
00:14:23,670 --> 00:14:26,960
So, instead it returns none as you
saw when I just pressed enter there.

244
00:14:26,960 --> 00:14:29,150
And you can actually test for
that if you wanted to.

245
00:14:29,150 --> 00:14:32,440
And you can actually confirm again
If I typed in something like

246
00:14:34,000 --> 00:14:38,050
instead of just pressing enter
we still get come up with none.

247
00:14:38,050 --> 00:14:42,870
Because it wasn't found for it to be
typed on the it actually works just fine.

248
00:14:42,870 --> 00:14:45,310
So, actually taking it one step
further before we finish this video.

249
00:14:46,820 --> 00:14:49,730
For the moment it's sharing
a respective that it's trying print

250
00:14:49,730 --> 00:14:51,890
out the description, but
what we can do here.

251
00:14:51,890 --> 00:14:54,990
We could do a test just
after here before we

252
00:14:54,990 --> 00:14:58,320
set the description to see whether
it exists in the dictionary.

253
00:14:58,320 --> 00:15:06,490
So we can type if dict underscore k
in fruit, so using the in keyboard.

254
00:15:06,490 --> 00:15:08,870
Then and
only then are we gonna set description.

255
00:15:08,870 --> 00:15:09,390
And print.

256
00:15:10,870 --> 00:15:13,560
Otherwise we'll put else, print.

257
00:15:15,690 --> 00:15:23,630
Don't have a dict_key, making sure you've
got your indentation levels correct here,

258
00:15:23,630 --> 00:15:25,560
cuz obviously the code
won't work without that.

259
00:15:25,560 --> 00:15:28,360
And of course I need to put
a colon there to fix it up.

260
00:15:28,360 --> 00:15:32,590
So if I run that now and
I just type something like apple.

261
00:15:33,620 --> 00:15:36,590
But if you type in something
like tomato Tomato.

262
00:15:36,590 --> 00:15:38,050
We didn't have a tomato.

263
00:15:39,120 --> 00:15:41,370
Cucumber, we don't have cucumber.

264
00:15:41,370 --> 00:15:42,090
Enter.

265
00:15:42,090 --> 00:15:44,690
We don't have so
I guess we could have tested for that.

266
00:15:44,690 --> 00:15:48,040
We could have made sure that did top,
something it better but

267
00:15:48,040 --> 00:15:51,180
we haven't done that so consequently
it's just printed out the empty string.

268
00:15:51,180 --> 00:15:53,650
If we put something like apple,
which is valid.

269
00:15:53,650 --> 00:15:57,340
Apple, lemon, you can see it's
printing those out quite nicely.

270
00:15:57,340 --> 00:15:59,460
We can type quit to exit out like so.

271
00:16:00,500 --> 00:16:02,850
So, I'm gonna end this video here now
cuz it's getting a little bit long,

272
00:16:02,850 --> 00:16:03,740
as I mentioned.

273
00:16:03,740 --> 00:16:05,770
In the next video I'll
continue exploring and

274
00:16:05,770 --> 00:16:08,310
going into more detail
about Python Dictionaries.

