1
00:00:00,960 --> 00:00:01,770
Hello, dear friends.

2
00:00:02,700 --> 00:00:09,630
So in this lesson, we are going to go over some data type operators and the methods in Python.

3
00:00:10,230 --> 00:00:11,970
So why don't we just go ahead and get started?

4
00:00:13,270 --> 00:00:16,450
So first up, we're going to need to define some variables.

5
00:00:17,230 --> 00:00:19,750
I hope you remember what they look like for string.

6
00:00:20,530 --> 00:00:24,490
String underscore one equals one, two, three, four, five, six, seven.

7
00:00:24,520 --> 00:00:25,390
Remember the quotes?

8
00:00:30,070 --> 00:00:36,940
For list list underscore one equals one, two, three, four, five, six, seven, and the brackets.

9
00:00:41,420 --> 00:00:47,180
For tuples, Tibbles one equals parentheses, one, two, three, four, five, six, seven.

10
00:00:47,780 --> 00:00:49,430
And remember to close up parentheses.

11
00:00:54,670 --> 00:00:57,670
Prediction Chenery take to underscore one equals.

12
00:00:59,460 --> 00:01:01,830
One coal and one.

13
00:01:03,290 --> 00:01:04,790
To Coleman to.

14
00:01:06,110 --> 00:01:10,430
Three Colin three, four, Colin, four.

15
00:01:12,060 --> 00:01:13,140
Five, Colin, five.

16
00:01:15,800 --> 00:01:16,760
Six, Colin, six.

17
00:01:18,710 --> 00:01:19,910
Seven on seven.

18
00:01:22,200 --> 00:01:29,010
Remember, the curly braces and Forsett said underscore one equals curly brace, one, two, three,

19
00:01:29,010 --> 00:01:30,300
four, five, six, seven.

20
00:01:30,750 --> 00:01:32,850
And close it up with the curly brace.

21
00:01:34,110 --> 00:01:34,500
Cool.

22
00:01:34,770 --> 00:01:36,120
So now our variables are ready.

23
00:01:36,780 --> 00:01:40,330
So our first task is finding an index.

24
00:01:40,380 --> 00:01:50,850
So indexing means we're referring to an element of an iterable by its position within the iterable.

25
00:01:51,900 --> 00:01:54,480
OK, so for this, we're going to use square brackets.

26
00:01:54,780 --> 00:01:59,350
Please look carefully and type string.

27
00:01:59,610 --> 00:02:04,320
Underscore one bracket to close bracket.

28
00:02:08,100 --> 00:02:11,790
List underscore one bracket three.

29
00:02:12,180 --> 00:02:13,050
Close bracket.

30
00:02:16,620 --> 00:02:21,780
Troubles underscore one bracket and close that square bracket.

31
00:02:23,350 --> 00:02:28,090
And the results are, as you see here now, there is something that we're going to need to look out

32
00:02:28,090 --> 00:02:33,970
for, the python language will always start indexing from zero.

33
00:02:34,750 --> 00:02:39,280
So it means that when we need to find a second element in our variable, we're going to write one.

34
00:02:39,430 --> 00:02:43,360
I mean, that's just something that you're either already used to or you're going to need to get used

35
00:02:43,360 --> 00:02:43,600
to.

36
00:02:44,560 --> 00:02:50,500
Also, with the help of the minus symbol, we can find the index from the end to the head.

37
00:02:52,110 --> 00:02:54,630
String one minus two in brackets.

38
00:03:01,590 --> 00:03:03,630
List one minus three.

39
00:03:08,830 --> 00:03:11,320
Tuples minus one.

40
00:03:18,040 --> 00:03:18,490
Get it.

41
00:03:19,240 --> 00:03:24,340
So here when we type the minus one, we can find the last element in our variable.

42
00:03:26,400 --> 00:03:33,030
Now, of course, we can also select a particular piece of string, one to Colin five.

43
00:03:39,050 --> 00:03:41,690
List one, Colan three.

44
00:03:45,300 --> 00:03:48,810
Tuples one minus two, Kollin, four.

45
00:03:49,440 --> 00:03:52,770
And please note, those are all in the square brackets.

46
00:03:54,240 --> 00:03:56,040
And you see the results.

47
00:03:57,540 --> 00:04:00,380
So here our first number refers to the star.

48
00:04:00,390 --> 00:04:02,190
The second number refers to the end.

49
00:04:03,540 --> 00:04:10,470
Now, when we want to start from zero, well, we don't need to type it like this.

50
00:04:11,730 --> 00:04:13,170
This is called slicing.

51
00:04:14,680 --> 00:04:21,730
So insets and dictionaries were not going to be able to do indexing or slicing because the order of

52
00:04:21,730 --> 00:04:25,810
the elements in a set is going to be undefined.

53
00:04:26,970 --> 00:04:31,770
So in dictionaries, the index value is replaced by a key value.

54
00:04:32,370 --> 00:04:32,730
All right.

55
00:04:33,690 --> 00:04:37,950
So let's move on now with the help of the Lende method.

56
00:04:38,580 --> 00:04:40,950
We can find our data types length.

57
00:04:41,880 --> 00:04:42,960
Why don't we give it a try?

58
00:04:43,860 --> 00:04:44,490
Len?

59
00:04:46,620 --> 00:04:49,950
Parenthesis, string, underscore one close princess.

60
00:04:51,080 --> 00:04:56,240
Len list one, Len Tuples one.

61
00:05:02,950 --> 00:05:04,840
Len DECT one.

62
00:05:08,680 --> 00:05:13,210
And Len, set one, and you're looking at the results.

63
00:05:15,510 --> 00:05:18,450
Now, what if we want to add an element into our variables?

64
00:05:19,050 --> 00:05:19,860
Yeah, it's possible.

65
00:05:19,870 --> 00:05:20,640
So let's have a look.

66
00:05:22,060 --> 00:05:25,270
String one plus equals eight.

67
00:05:34,650 --> 00:05:39,720
List underscore one that append parentheses hit close princes.

68
00:05:45,320 --> 00:05:48,410
Set one dot, add eight.

69
00:05:52,210 --> 00:05:54,610
Dick underscore one eight.

70
00:05:55,180 --> 00:05:57,670
Please note the quotes equals eight.

71
00:06:04,760 --> 00:06:05,570
So let's check them.

72
00:06:24,180 --> 00:06:26,490
And the result is what you see here.

73
00:06:28,470 --> 00:06:32,130
So we can't add an element into our troubles.

74
00:06:32,160 --> 00:06:32,490
Why?

75
00:06:33,090 --> 00:06:34,620
Because they are immutable.

76
00:06:50,390 --> 00:06:53,810
Now, also, we can remove an element from our variables.

77
00:06:54,320 --> 00:06:57,860
Let me show you that list, one dot pop.

78
00:07:04,420 --> 00:07:05,890
DECT one dot pop.

79
00:07:08,740 --> 00:07:09,220
Eight.

80
00:07:11,970 --> 00:07:13,020
And let's check them.

81
00:07:21,110 --> 00:07:23,570
And the results are what you see right here.

82
00:07:24,530 --> 00:07:28,610
Now, the pop method will remove one element every time.

83
00:07:29,180 --> 00:07:35,870
So if we don't define a value, it will remove the last element by default in doubles.

84
00:07:36,650 --> 00:07:40,640
Now, of course, we can't remove an element because right there are immutable.

85
00:07:53,280 --> 00:07:55,620
Now, let me show you something else with the help of the count method.

86
00:07:55,950 --> 00:07:59,940
We can learn how many times each element occurs in our variables.

87
00:08:00,510 --> 00:08:01,470
Let's give that a shot.

88
00:08:02,410 --> 00:08:05,170
First, we needed to find new variables.

89
00:08:05,830 --> 00:08:07,360
String two equals.

90
00:08:09,620 --> 00:08:10,880
El Lewine, Don.

91
00:08:16,560 --> 00:08:20,130
List two equals l o n d o n.

92
00:08:34,480 --> 00:08:37,870
Tuples two equals l o n d o n.

93
00:08:56,060 --> 00:08:57,200
Get those quotes in there.

94
00:08:58,190 --> 00:09:05,840
Now, we didn't define a new dictionary and set because dictionaries key value is unique, so they can't

95
00:09:05,840 --> 00:09:11,660
actually have a repeated element and also sets can't have a repeated element.

96
00:09:11,690 --> 00:09:12,650
But you already knew that.

97
00:09:13,160 --> 00:09:13,460
Right.

98
00:09:14,420 --> 00:09:15,440
OK, so let's continue.

99
00:09:17,220 --> 00:09:19,170
String to account.

100
00:09:20,270 --> 00:09:20,690
NN.

101
00:09:28,440 --> 00:09:31,260
List to account nr.

102
00:09:36,900 --> 00:09:38,820
Tuples to account NP.

103
00:09:43,830 --> 00:09:45,450
And here are the results.

104
00:09:49,670 --> 00:09:55,190
Now, with the help of the update method, we can combine two different dictionaries and sets.

105
00:09:56,150 --> 00:09:57,380
So let me show you what that looks like.

106
00:09:57,710 --> 00:09:58,100
I'll try.

107
00:09:59,180 --> 00:10:03,650
So first, let's define a new set and a dictionary set.

108
00:10:03,650 --> 00:10:09,170
Two equals curly braces, you remember and write 10, 11 and 12.

109
00:10:14,630 --> 00:10:19,580
Dict two equals curly braces, quote, nine, unquote, colon nine.

110
00:10:22,610 --> 00:10:24,110
10, callon 10.

111
00:10:27,030 --> 00:10:29,370
11 Colan 11.

112
00:10:29,880 --> 00:10:30,240
All right.

113
00:10:32,400 --> 00:10:36,090
Now, type set one dot update.

114
00:10:40,840 --> 00:10:42,070
Set to.

115
00:10:47,270 --> 00:10:48,770
DECT one done update.

116
00:10:53,490 --> 00:10:54,450
DECT two.

117
00:10:57,370 --> 00:10:58,720
And let's check the results.

118
00:11:02,510 --> 00:11:03,500
And what do you think of that?

119
00:11:05,100 --> 00:11:06,270
Good job, well done.

120
00:11:06,660 --> 00:11:07,560
Very good work.

121
00:11:08,310 --> 00:11:13,380
We learned some very useful methods and operations with our data types in this lesson.

122
00:11:14,370 --> 00:11:17,970
I've got some great stuff in store coming up, though, so I want to see in the next lesson.

123
00:11:18,870 --> 00:11:20,340
Until then, have a nice day.
