1
00:00:00,600 --> 00:00:01,800
Hello, dear friends.

2
00:00:02,070 --> 00:00:05,880
So this is the lesson that we're going to learn some other data types in Blyton.

3
00:00:06,570 --> 00:00:07,350
So let's start.

4
00:00:09,910 --> 00:00:15,910
As you remember, we talked about the data type concept in Python in some of our previous lessons.

5
00:00:16,750 --> 00:00:19,750
We've also talked about the concepts of strings and numbers.

6
00:00:20,860 --> 00:00:25,030
Now we're going to dive a little deeper and examine the list data type in Python.

7
00:00:25,630 --> 00:00:33,580
But before we talk about the concept of list, we also need to understand the concept of sequences.

8
00:00:34,720 --> 00:00:40,990
So what are sequences the most basic data structure in Python is sequences.

9
00:00:41,980 --> 00:00:47,380
Each element of a sequence is assigned a number, its position or index.

10
00:00:48,250 --> 00:00:49,840
The first index is zero.

11
00:00:50,470 --> 00:00:51,910
The second index is one.

12
00:00:52,000 --> 00:00:52,510
And so on.

13
00:00:53,440 --> 00:00:56,380
So Python has six built in types of sequences.

14
00:00:57,310 --> 00:00:58,960
And we already know one of them.

15
00:00:59,380 --> 00:01:00,340
Do you remember which one?

16
00:01:01,330 --> 00:01:02,770
Yep, strings.

17
00:01:04,120 --> 00:01:07,840
And the other most common ones are lists, tuples and dictionaries.

18
00:01:08,710 --> 00:01:13,270
Now, there are certain things that you can do with all sequence types.

19
00:01:14,580 --> 00:01:21,330
So these operations will include indexing, slicing, adding, multiplying and checking for membership.

20
00:01:23,050 --> 00:01:29,710
In addition, Python has some built in functions for finding the length of a sequence and for finding

21
00:01:29,710 --> 00:01:32,590
it largest and smallest elements.

22
00:01:33,520 --> 00:01:37,360
So we're going to talk about all of these operations a bit later in the course.

23
00:01:38,380 --> 00:01:41,980
Right now, we want to talk about the list concept in Python.

24
00:01:42,310 --> 00:01:42,640
Right.

25
00:01:43,540 --> 00:01:46,990
So what is this list that you speak of?

26
00:01:48,250 --> 00:01:52,120
So the list is the most versatile data type available in Python.

27
00:01:52,750 --> 00:01:59,980
And it can be written as a list of comma separated values or items between square brackets.

28
00:02:01,240 --> 00:02:08,470
An important thing to know about a list is that items in a list don't need to be of the same type.

29
00:02:09,280 --> 00:02:10,240
What?

30
00:02:11,230 --> 00:02:13,090
So how do we create a list?

31
00:02:14,150 --> 00:02:18,230
Well, it just so happens that creating a list is one of the simplest things you can do.

32
00:02:18,260 --> 00:02:23,540
It's as simple as putting different comma separated values between square brackets.

33
00:02:24,770 --> 00:02:31,910
Lists typically store homogenous data that is values of the same data type.

34
00:02:33,200 --> 00:02:38,330
So, for example, let's define a variable named my list minus equals.

35
00:02:41,770 --> 00:02:43,840
One, two, three, four, five, six, seven, eight.

36
00:02:49,370 --> 00:02:51,920
So we created our variable, now let's check IDs type.

37
00:02:56,920 --> 00:02:59,920
And of course, its type is list so we can move on.

38
00:03:01,980 --> 00:03:05,830
As you can see in this list, all of the elements are numbers.

39
00:03:07,410 --> 00:03:11,820
But we also said that not elements have to be the same type.

40
00:03:13,280 --> 00:03:17,990
So if we define a variable name, my list to my list equals to.

41
00:03:23,020 --> 00:03:23,930
One, two, three.

42
00:03:23,960 --> 00:03:25,050
Apple, banana.

43
00:03:25,120 --> 00:03:27,370
15, 25 A. B..

44
00:03:27,790 --> 00:03:28,840
Thirteen point five.

45
00:03:37,500 --> 00:03:39,150
So we created our variable.

46
00:03:39,180 --> 00:03:40,560
Now let's check it's type.

47
00:03:41,840 --> 00:03:42,800
And the type.

48
00:03:48,320 --> 00:03:49,340
Is also a list.

49
00:03:50,270 --> 00:03:51,260
So let's move on.

50
00:03:52,130 --> 00:03:55,100
And as you can see in this list, different types of data were stored.

51
00:03:55,310 --> 00:03:58,220
Such lists are called heterogenous lists.

52
00:03:59,290 --> 00:04:05,680
So we can also define a list in and on their list, such as my list and score three equals.

53
00:04:09,310 --> 00:04:10,060
One, two, three.

54
00:04:11,410 --> 00:04:12,550
One, two, three.

55
00:04:12,580 --> 00:04:13,570
Apple, banana.

56
00:04:16,450 --> 00:04:17,230
Apple, banana.

57
00:04:21,400 --> 00:04:24,550
Now, of course, this type of list is called a nested list.

58
00:04:25,510 --> 00:04:28,000
So if you want to, we can check this one's data type.

59
00:04:33,940 --> 00:04:40,000
And as you can see, it's also a list, so the lists elements are mutable.

60
00:04:40,630 --> 00:04:43,330
It means that their elements can be modified.

61
00:04:44,330 --> 00:04:46,550
So that gives you all kinds of fun, huh?

62
00:04:47,510 --> 00:04:52,050
Now, unlike list, some sequences are immutable.

63
00:04:52,130 --> 00:04:56,090
So that means they can't be modified like tuples.

64
00:04:57,900 --> 00:04:59,370
What are troubles?

65
00:05:00,930 --> 00:05:03,480
Well, they are temples are also sequences.

66
00:05:04,260 --> 00:05:12,180
They are really similar to a list, but their biggest difference is that they cannot be changed.

67
00:05:12,390 --> 00:05:14,310
So we call them immutable.

68
00:05:14,850 --> 00:05:15,570
And why is it?

69
00:05:16,590 --> 00:05:23,670
Well, when we need immutable data in our program, such as a config file or something else, tuples

70
00:05:23,850 --> 00:05:26,400
give us the opportunity to be able to write that.

71
00:05:27,300 --> 00:05:28,860
So then how do we create a tuple?

72
00:05:30,010 --> 00:05:36,700
While creating a table is as simple as putting different comma separated values, and optionally we

73
00:05:36,700 --> 00:05:40,570
can put these commas everyday values between parentheses also.

74
00:05:42,140 --> 00:05:43,730
So now let's see how to create a temple.

75
00:05:44,850 --> 00:05:47,130
We will define a variable named My Temple.

76
00:05:52,640 --> 00:05:54,230
One, two, three, four, five, six, seven, eight.

77
00:05:56,740 --> 00:06:00,070
So we create our variable, let's check its type.

78
00:06:03,990 --> 00:06:06,570
So this tape is indeed a table, so move on.

79
00:06:08,640 --> 00:06:12,300
And as you can see in this table, all elements are numbers.

80
00:06:13,550 --> 00:06:19,760
But now you also remember that I said that not all elements have to be the same type.

81
00:06:20,420 --> 00:06:23,030
So we can define a variable named might double to.

82
00:06:28,040 --> 00:06:31,190
Might hold two equals one, two, three, apple, banana.

83
00:06:33,730 --> 00:06:34,810
13 PTFI.

84
00:06:36,160 --> 00:06:37,900
A B, thirteen point five.

85
00:06:41,200 --> 00:06:43,070
All right, great, so we created our variable.

86
00:06:43,090 --> 00:06:44,110
Let's check it's type.

87
00:06:48,840 --> 00:06:51,840
This type is also a tuple so we can move on.

88
00:06:53,100 --> 00:06:57,060
And as you can see in this table, different types of data were stored.

89
00:06:58,080 --> 00:07:01,050
Such doubles are called heterogenous doubles.

90
00:07:02,510 --> 00:07:09,830
Now we can also define a table in another table, just like in lists such as my table three equals.

91
00:07:11,570 --> 00:07:13,010
One, two, three, one, two, three.

92
00:07:15,950 --> 00:07:17,240
Apple, banana.

93
00:07:20,800 --> 00:07:22,060
Apple, banana.

94
00:07:24,860 --> 00:07:28,670
So this type of list is, remember, called in nested list.

95
00:07:29,420 --> 00:07:31,610
And if you want, we can check this one's datatype.

96
00:07:39,810 --> 00:07:41,830
And as you can see, it's also a tuple.

97
00:07:44,080 --> 00:07:47,710
So far, almost everything is the same as a list, right?

98
00:07:49,230 --> 00:07:51,180
And I hear what you're saying.

99
00:07:51,620 --> 00:07:57,900
Well, I didn't see any difference between listen double's and my young apprentice.

100
00:07:59,160 --> 00:08:06,240
We will see all the differences between the lists and tuples when we start to use operators and methods.

101
00:08:07,010 --> 00:08:07,530
Hmm.

102
00:08:08,400 --> 00:08:09,570
Now let's continue.

103
00:08:10,410 --> 00:08:15,060
What if we want to create a trouble with one element?

104
00:08:16,110 --> 00:08:17,520
So let's define a variable name.

105
00:08:17,520 --> 00:08:20,250
My table for my double for equals.

106
00:08:22,380 --> 00:08:26,820
Five, we create our variable and let's check IDs type.

107
00:08:30,650 --> 00:08:33,680
Was its type, is it?

108
00:08:34,070 --> 00:08:34,820
But why?

109
00:08:35,270 --> 00:08:36,500
Everything looks fine.

110
00:08:36,850 --> 00:08:38,990
But why does our variable datatype.

111
00:08:39,020 --> 00:08:39,320
Why?

112
00:08:39,320 --> 00:08:40,390
Why is it end?

113
00:08:41,670 --> 00:08:43,430
Are the reasons very simple?

114
00:08:44,150 --> 00:08:49,400
Previously, when we defined a tuple, we use the expression comma separated values.

115
00:08:50,060 --> 00:08:55,040
So if we want to create a table with one element, we always use a comma.

116
00:08:55,520 --> 00:08:56,120
Let's try it.

117
00:08:57,230 --> 00:08:59,990
So we define a variable named my tuple five.

118
00:09:00,290 --> 00:09:01,820
My tuple five equals.

119
00:09:05,180 --> 00:09:09,080
Five comma, and we create our variable.

120
00:09:09,350 --> 00:09:10,430
So let's check it's type.

121
00:09:17,280 --> 00:09:20,460
Oh, thank God it's Tapo.

122
00:09:21,390 --> 00:09:26,130
OK, so now if everything seems OK, we can continue with another datatype.

123
00:09:26,370 --> 00:09:27,810
It's called Dictionaries, Yohana.

124
00:09:28,290 --> 00:09:29,100
OK, follow me.

125
00:09:31,170 --> 00:09:32,670
So what are dictionaries here?

126
00:09:33,750 --> 00:09:37,770
So dictionaries are data set that behaves just like real life dictionaries.

127
00:09:38,430 --> 00:09:43,530
But this data set is inherently different from any data set that we've ever seen here before.

128
00:09:44,310 --> 00:09:48,450
Each element in the dictionary is kept as key and value.

129
00:09:49,500 --> 00:09:50,580
So what is the key?

130
00:09:51,690 --> 00:09:54,330
Well, let's think about an English dictionary in real life.

131
00:09:54,870 --> 00:09:58,020
We choose a word in English, for example, decrees.

132
00:09:59,080 --> 00:10:06,820
In the English dictionary, decrease means make or become smaller or fewer in size amount, intensity

133
00:10:06,820 --> 00:10:07,570
or degree.

134
00:10:08,380 --> 00:10:10,930
So here decrease is our key.

135
00:10:11,980 --> 00:10:14,200
And this part is our value.

136
00:10:15,730 --> 00:10:16,150
Clear.

137
00:10:16,720 --> 00:10:18,100
OK, so now let's move on.

138
00:10:18,850 --> 00:10:20,230
How do we create a dictionary?

139
00:10:21,250 --> 00:10:25,810
So each key is separated from its value by a colon.

140
00:10:27,070 --> 00:10:33,910
The items are separated by commas, and the whole thing is enclosed in curly braces.

141
00:10:35,230 --> 00:10:42,310
Such as we define a variable named my DECT, so my dick equals zero, colon zero.

142
00:10:44,480 --> 00:10:46,070
One, Colin, one.

143
00:10:48,430 --> 00:10:49,960
To call in to.

144
00:10:52,450 --> 00:10:53,620
Three call and three.

145
00:10:55,530 --> 00:10:57,150
For Colin, for.

146
00:11:00,070 --> 00:11:01,870
Five, Colin, five.

147
00:11:03,060 --> 00:11:04,260
So let's check the data type.

148
00:11:09,590 --> 00:11:14,270
Look at that, you see, our variable's datatype is DECT, which means dictionary.

149
00:11:15,290 --> 00:11:18,200
And what if we wanted to find an empty dictionary?

150
00:11:18,830 --> 00:11:19,610
Oh, it's so simple.

151
00:11:20,660 --> 00:11:25,520
The dictionary, without any items, is written with just two curly braces like this.

152
00:11:28,260 --> 00:11:29,460
So let's check the datatype.

153
00:11:38,590 --> 00:11:42,940
Keys are unique within a dictionary, while values may not be.

154
00:11:43,510 --> 00:11:47,380
For example, we define a variable named mine dict, too.

155
00:11:48,310 --> 00:11:56,590
So in this dictionary, keys are the name of months and the values are the numbers of days in the corresponding

156
00:11:56,590 --> 00:11:56,860
month.

157
00:11:59,450 --> 00:12:03,170
OK, my dick two equals Jan Gowland, 31.

158
00:12:05,700 --> 00:12:07,440
February Collen 28.

159
00:12:09,610 --> 00:12:11,050
March Quillin, 31.

160
00:12:17,880 --> 00:12:18,990
So let's check the datatype.

161
00:12:25,330 --> 00:12:26,410
It's also a dictionary.

162
00:12:27,190 --> 00:12:30,550
And as you can see, different keys can have the same value.

163
00:12:31,940 --> 00:12:35,870
Now, I wonder if we want to enter more than one entry per key.

164
00:12:37,010 --> 00:12:39,140
We define a variable named Mindich three.

165
00:12:44,210 --> 00:12:47,390
Mind EC3 equals name Golin John.

166
00:12:49,930 --> 00:12:52,240
Comma, surname, Colin Doe.

167
00:12:54,930 --> 00:12:58,170
Cummer job Colan unemployed.

168
00:13:01,750 --> 00:13:05,200
KOMMA job Colan, software developer.

169
00:13:11,760 --> 00:13:12,870
So let's check the date of time.

170
00:13:22,100 --> 00:13:23,120
It's also a dictionary.

171
00:13:23,990 --> 00:13:30,350
And as you can see, we duplicated the key named John and gave it to different values.

172
00:13:31,100 --> 00:13:33,200
But what value did it take?

173
00:13:34,010 --> 00:13:38,330
As Jack, print my DECT three job.

174
00:13:49,730 --> 00:13:50,330
Colon.

175
00:13:51,610 --> 00:13:54,070
Karma, my DECT three job.

176
00:14:06,320 --> 00:14:08,630
And the result is software developer.

177
00:14:09,620 --> 00:14:15,200
So that means when duplicate keys encountered during the assignment, the last assignment went.

178
00:14:16,820 --> 00:14:19,070
The values of a dictionary can be of any type.

179
00:14:19,430 --> 00:14:25,220
But the keys must be of an immutable data type, such as strings, numbers or tables.

180
00:14:26,830 --> 00:14:30,100
For example, will define a variable named mine dict for.

181
00:14:34,110 --> 00:14:37,860
My date for equals name Bentley.

182
00:14:41,480 --> 00:14:42,110
Model.

183
00:14:43,270 --> 00:14:44,350
Brooklands.

184
00:14:47,930 --> 00:14:48,710
Yea.

185
00:14:50,070 --> 00:14:51,330
1997.

186
00:14:52,770 --> 00:14:53,040
All right.

187
00:14:53,130 --> 00:14:57,960
Oh, that's a really nice car, but that's not the point when we run this code.

188
00:14:58,200 --> 00:14:59,460
Python gives us an error.

189
00:14:59,820 --> 00:15:00,270
Why?

190
00:15:00,480 --> 00:15:03,660
It says uncatchable type list.

191
00:15:05,000 --> 00:15:05,360
Wow.

192
00:15:06,710 --> 00:15:07,760
Never mind about that.

193
00:15:08,330 --> 00:15:10,580
The values of a dictionary can be of any type.

194
00:15:10,970 --> 00:15:14,270
But the keys must be of an immutable data type.

195
00:15:14,630 --> 00:15:17,210
This was the general outline of dictionaries.

196
00:15:17,780 --> 00:15:18,710
Let's continue for now.

197
00:15:20,710 --> 00:15:26,470
So now I got to introduce you to our final data type, which is called sets.

198
00:15:27,190 --> 00:15:30,100
So what our sets and why didn't you tell me about this before?

199
00:15:31,120 --> 00:15:37,240
So our sets are closely linked to the concept of sets, which we know for mathematics.

200
00:15:37,240 --> 00:15:37,540
Right.

201
00:15:38,800 --> 00:15:42,250
Also, this data type has all the properties of sets in map.

202
00:15:43,120 --> 00:15:46,150
That is to say, the intersection, Joy.

203
00:15:47,310 --> 00:15:48,990
So what's the difference?

204
00:15:49,980 --> 00:15:55,740
Well, the difference that we know from sets in mathematics also apply to sets in Python.

205
00:15:56,910 --> 00:15:58,200
So how do we create a set?

206
00:15:59,300 --> 00:16:04,340
Creating a said is as simple as putting different comma separated values between curly brackets.

207
00:16:05,330 --> 00:16:07,430
We define a variable named my set.

208
00:16:07,880 --> 00:16:08,150
All right.

209
00:16:08,150 --> 00:16:10,490
So Micelle equals one, two, three, four, five.

210
00:16:15,710 --> 00:16:16,940
And we create our variable.

211
00:16:17,090 --> 00:16:18,080
Let's check IDs type.

212
00:16:20,760 --> 00:16:21,810
It's Tiber's set.

213
00:16:23,200 --> 00:16:24,770
Now let's define another variable.

214
00:16:24,920 --> 00:16:26,170
They might set two.

215
00:16:28,240 --> 00:16:32,140
I said two equals A, B, C, D and E.

216
00:16:39,790 --> 00:16:41,020
And we create our variable.

217
00:16:41,170 --> 00:16:42,160
Let's check IDs type.

218
00:16:48,520 --> 00:16:49,570
It's type of set.

219
00:16:52,420 --> 00:16:53,710
Now, why do we need to use it?

220
00:16:54,610 --> 00:16:58,930
Because yet, as in math, our data set that whole.

221
00:16:59,140 --> 00:17:00,670
Only one of each element.

222
00:17:01,270 --> 00:17:07,240
So this means that when the set is created, the duplicate element is automatically eliminated.

223
00:17:08,320 --> 00:17:09,820
All right, so let me show you an example.

224
00:17:11,000 --> 00:17:14,330
So here we will define a variable named my set free.

225
00:17:14,990 --> 00:17:21,980
I said three equals one to two, three, three, three, four, four, five.

226
00:17:24,120 --> 00:17:26,880
Now, when we run this code, our sets been created.

227
00:17:27,390 --> 00:17:28,220
Now let's check it.

228
00:17:28,350 --> 00:17:29,190
I set three.

229
00:17:30,550 --> 00:17:33,550
And look at that, the repeating elements have been eliminated.

230
00:17:35,050 --> 00:17:40,150
So in this lesson, we learned the rest of the important data types in Python and how to define them

231
00:17:40,780 --> 00:17:46,810
in the next lesson, we will learn the useful data types of operations and methods in Python.

232
00:17:47,590 --> 00:17:49,360
So I'll see you in that next lesson.

233
00:17:50,080 --> 00:17:53,170
Review what you need to know and have a nice day.
