1
00:00:02,040 --> 00:00:09,090
This lecture is one of the most important lectures of the entire course, so don't miss it if you are

2
00:00:09,090 --> 00:00:12,300
able to understand what I'm talking about in this lecture.

3
00:00:13,420 --> 00:00:16,480
I'm pretty sure you will succeed with Python.

4
00:00:18,120 --> 00:00:23,100
So I'm going to talk about the anatomy of the Python programming language.

5
00:00:24,870 --> 00:00:29,490
Part of this video will be a summary of what you have learned so far.

6
00:00:30,000 --> 00:00:38,370
So I'll be going over the concepts you have learned and review them and explain them from another perspective

7
00:00:38,880 --> 00:00:43,470
so that you can see things from a different angle.

8
00:00:45,680 --> 00:00:46,670
Let's start.

9
00:00:47,480 --> 00:00:52,310
The first thing I want you to understand is that a program.

10
00:00:53,130 --> 00:00:56,640
It's like a place in the real world.

11
00:00:57,060 --> 00:00:59,130
Let's say a cafe.

12
00:01:00,870 --> 00:01:02,850
Things happen in a program.

13
00:01:03,060 --> 00:01:04,890
Things happen in a cafe.

14
00:01:06,500 --> 00:01:07,880
In the program.

15
00:01:08,480 --> 00:01:11,910
You are the programmer in the cafe.

16
00:01:11,930 --> 00:01:17,870
It's again you who orders a coffee, who orders a salad, etc..

17
00:01:19,450 --> 00:01:23,110
For example, to order a coffee in the cafe.

18
00:01:29,040 --> 00:01:32,760
You use the older coffee function, so to say.

19
00:01:34,110 --> 00:01:39,690
To order a list of to the items in the program you use the get.

20
00:01:41,800 --> 00:01:44,110
To do this function.

21
00:01:46,040 --> 00:01:51,290
You tell the function that to dos the text file as a string.

22
00:01:53,580 --> 00:01:57,360
In the case of ordering a coffee, you tell.

23
00:01:58,400 --> 00:02:01,250
This function that you want a coffee?

24
00:02:04,370 --> 00:02:13,040
You tell if it's going to be a short coffee or long and maybe you tell this function how many coffees

25
00:02:13,040 --> 00:02:13,880
you want.

26
00:02:13,910 --> 00:02:15,440
Let's say you want to.

27
00:02:16,630 --> 00:02:18,760
But so far, so good.

28
00:02:18,770 --> 00:02:19,880
This is clear.

29
00:02:19,910 --> 00:02:26,920
Now, here is the thing, and this is about understanding what actually types are in Python.

30
00:02:26,930 --> 00:02:34,670
So the data types, I've been talking about data types, but you can also refer to them as types this

31
00:02:34,670 --> 00:02:36,050
to this function.

32
00:02:37,880 --> 00:02:38,870
Gives us.

33
00:02:40,740 --> 00:02:42,720
A list of two dos.

34
00:02:43,460 --> 00:02:48,200
So first to do, second to do item, etc..

35
00:02:49,070 --> 00:02:52,760
Well, this function here gives us a coffee.

36
00:02:57,470 --> 00:02:59,000
Maybe in the cafe.

37
00:02:59,030 --> 00:03:06,650
You also use other functions such as the P function as inputs.

38
00:03:06,650 --> 00:03:08,150
You give money.

39
00:03:12,080 --> 00:03:13,250
As output.

40
00:03:13,250 --> 00:03:16,160
You get a receipt.

41
00:03:19,080 --> 00:03:24,600
Maybe you also use another function such as Clean the table.

42
00:03:25,260 --> 00:03:29,280
So you ask for a clean service from the waiter.

43
00:03:29,760 --> 00:03:33,000
And in this case.

44
00:03:34,270 --> 00:03:36,640
You don't get an output.

45
00:03:38,560 --> 00:03:39,400
Same here.

46
00:03:39,400 --> 00:03:44,950
We have this right to do function.

47
00:03:45,100 --> 00:03:48,370
This also doesn't give us an output, as you see.

48
00:03:48,550 --> 00:03:51,220
We are not returning anything in here.

49
00:03:52,630 --> 00:03:54,700
As we do in the get to this function.

50
00:03:54,700 --> 00:03:59,740
So this get to those functions gives us a an instance of a list.

51
00:04:01,820 --> 00:04:05,470
Now here is where you should make the distinction.

52
00:04:05,480 --> 00:04:10,320
I said an instance of a list, not a list itself.

53
00:04:10,340 --> 00:04:15,320
We usually say this gives us a list, but the list itself.

54
00:04:17,750 --> 00:04:20,329
It's an abstract concept.

55
00:04:20,839 --> 00:04:23,990
The same is true for coffee.

56
00:04:25,700 --> 00:04:26,930
Or sipped.

57
00:04:31,990 --> 00:04:35,880
So all these are abstract concepts.

58
00:04:35,890 --> 00:04:44,830
The actual objects are this instance that we got here, the receipt which says probably €10 or $10.

59
00:04:45,550 --> 00:04:47,680
This coffee is an instance.

60
00:04:48,580 --> 00:04:50,530
Also the coffee.

61
00:04:51,400 --> 00:04:56,100
Could be bitter, could be warmer, sometimes could be hotter other times.

62
00:04:56,490 --> 00:04:59,460
So there are different instances of coffee.

63
00:04:59,910 --> 00:05:05,520
The concept itself, this one here is just an abstract in our minds.

64
00:05:06,900 --> 00:05:08,580
Same goes for sipped.

65
00:05:08,640 --> 00:05:10,380
Same goes for list.

66
00:05:10,470 --> 00:05:16,410
So saying that I'm drinking a coffee or I'm buying a pan is technically wrong.

67
00:05:16,500 --> 00:05:23,580
What we should be saying is I'm drinking an instance of a coffee or I'm buying an instance of a pen.

68
00:05:23,670 --> 00:05:26,600
You can say I invented the pen.

69
00:05:26,610 --> 00:05:28,060
That could make sense.

70
00:05:28,080 --> 00:05:30,680
You invented the pen concept.

71
00:05:30,750 --> 00:05:34,610
And then people buy instances of that pen.

72
00:05:34,620 --> 00:05:39,570
So these concepts in Python are also called classes.

73
00:05:39,570 --> 00:05:46,170
Subtypes or classes types or classes are used interchangeably to terms.

74
00:05:46,290 --> 00:05:52,260
So you can say this is a type, but you can also say this is a class.

75
00:05:52,380 --> 00:05:54,660
So it is a blueprint.

76
00:05:54,690 --> 00:05:58,440
Just like coffee is a blueprint in our minds.

77
00:05:58,440 --> 00:06:06,210
And we know how to make instances of coffee by having that coffee in our mind, that abstract concept

78
00:06:06,210 --> 00:06:07,110
in our minds.

79
00:06:07,560 --> 00:06:10,680
So same goes for lists and same goes for strings.

80
00:06:10,770 --> 00:06:15,900
Another example, we implemented this pause function.

81
00:06:17,740 --> 00:06:23,200
So that is another example of a function in programming.

82
00:06:23,970 --> 00:06:31,320
This POS function got a string such as six feet 12 inches and it returned.

83
00:06:34,200 --> 00:06:37,980
A dictionary instance with keys and values.

84
00:06:37,980 --> 00:06:41,490
So dictionaries are also.

85
00:06:46,080 --> 00:06:48,330
Instances of this dictionary.

86
00:06:49,130 --> 00:06:50,090
Class.

87
00:06:53,520 --> 00:06:58,080
So just like we have different types of classes in the real world.

88
00:06:59,190 --> 00:07:01,080
Such as coffee received.

89
00:07:01,110 --> 00:07:04,770
We have different types of classes in a program.

90
00:07:06,110 --> 00:07:13,100
By the way, this year, when you say coffee or when you say short and when you say two.

91
00:07:13,130 --> 00:07:15,500
These are also instances.

92
00:07:15,500 --> 00:07:16,880
So coffee.

93
00:07:17,920 --> 00:07:23,200
This here is an instance of speech you can say or.

94
00:07:24,890 --> 00:07:26,360
You can say words.

95
00:07:26,780 --> 00:07:34,010
So just like we have a string here, a string is also a class, and this is an instance of a string

96
00:07:34,100 --> 00:07:35,400
to do the task.

97
00:07:35,420 --> 00:07:44,780
This is also an instance of a word or a speech you can say, and the number is also an instance of a

98
00:07:44,780 --> 00:07:45,260
word.

99
00:07:45,260 --> 00:07:52,740
So you give words to this function over coffee and you get an actual cup of coffee, an instance of

100
00:07:52,740 --> 00:07:54,830
the coffee class.

101
00:07:55,070 --> 00:07:58,430
Now all these instances.

102
00:07:58,700 --> 00:08:04,250
So this coffee or another coffee, they all have their own methods.

103
00:08:04,430 --> 00:08:06,980
So you can drink a coffee.

104
00:08:10,400 --> 00:08:11,930
You can sweeten it.

105
00:08:15,120 --> 00:08:18,050
Received also have their own methods.

106
00:08:20,710 --> 00:08:27,010
Perhaps later you can get a refund using that receipt.

107
00:08:27,220 --> 00:08:28,510
Perhaps you can.

108
00:08:29,450 --> 00:08:30,350
Deduct.

109
00:08:32,530 --> 00:08:35,590
Taxes using that through if you.

110
00:08:36,419 --> 00:08:38,250
Or self-employed or so on.

111
00:08:38,520 --> 00:08:41,880
And we have the same things for.

112
00:08:43,470 --> 00:08:50,160
Objects in Python in a program, so at least have an append method.

113
00:08:52,510 --> 00:08:55,330
Have a pop method, etc..

114
00:08:55,360 --> 00:08:57,910
Streams also have their own methods.

115
00:08:59,080 --> 00:09:01,600
Dictionaries also have their own methods.

116
00:09:02,770 --> 00:09:08,290
So the function, for example, if we see.

117
00:09:09,990 --> 00:09:17,520
In Maine, that pie, if we see this, get to this function, this function.

118
00:09:18,690 --> 00:09:24,930
When we call it gives us the list and then we store the list in these two twos variable.

119
00:09:26,210 --> 00:09:32,600
No variables in the real world could be just the plate.

120
00:09:33,280 --> 00:09:36,820
Where you place that instance, that object instance.

121
00:09:36,820 --> 00:09:39,610
So the plate would replace that coffee cup.

122
00:09:40,540 --> 00:09:43,270
That could be the variable.

123
00:09:46,870 --> 00:09:51,190
The received can also be placed in a small plate.

124
00:09:51,220 --> 00:09:55,510
Sometimes objects are not placed in plates, as you see.

125
00:09:55,510 --> 00:10:00,340
For example, ADD here is not associated with any variable.

126
00:10:01,640 --> 00:10:03,620
So variables can be optional.

127
00:10:03,620 --> 00:10:06,680
Sometimes you need them, sometimes you don't need them.

128
00:10:08,370 --> 00:10:17,640
So once we get that list, that list instance is returned from this function, and then we can use that

129
00:10:17,640 --> 00:10:20,670
returned object in other parts of the code.

130
00:10:20,700 --> 00:10:22,890
Similarly with this coffee.

131
00:10:24,450 --> 00:10:25,320
In here.

132
00:10:25,860 --> 00:10:31,410
So once this older coffee function gives us the coffee cup, then we can drink it.

133
00:10:31,410 --> 00:10:36,420
We can sweeten it by adding sugar to it and so on.

134
00:10:37,620 --> 00:10:43,530
So the older coffee is the process which makes that object instance.

135
00:10:44,190 --> 00:10:50,670
Now the big question is who designs these glasses?

136
00:10:51,780 --> 00:10:53,580
Who designs a list?

137
00:10:53,700 --> 00:10:55,470
Who designs a dictionary?

138
00:10:56,670 --> 00:10:59,550
Can you design a new class?

139
00:11:00,300 --> 00:11:02,130
So, a blueprint.

140
00:11:03,740 --> 00:11:06,920
Well, we can ask the same question in the real world.

141
00:11:06,950 --> 00:11:08,890
Who designed the coffee?

142
00:11:08,900 --> 00:11:10,850
Who designed the received?

143
00:11:10,970 --> 00:11:14,090
Can you design a coffee or a new object?

144
00:11:14,120 --> 00:11:16,790
Can you design something new?

145
00:11:16,790 --> 00:11:22,700
Some blueprints, which other people can use than to make instances of it?

146
00:11:24,050 --> 00:11:25,980
Of course, in the real world you can do it.

147
00:11:26,000 --> 00:11:29,060
It's not easy, but you can do it.

148
00:11:29,930 --> 00:11:32,600
And the same exact answer.

149
00:11:34,280 --> 00:11:37,580
Is given for the program.

150
00:11:37,700 --> 00:11:47,390
So you can actually design new classes and then use those classes to create instances, different instances.

151
00:11:47,810 --> 00:11:50,540
But when why would you design a class?

152
00:11:52,760 --> 00:11:55,820
Well, let's say that you want to create.

153
00:11:57,200 --> 00:12:02,120
A graphical user interface with buttons and text boxes.

154
00:12:02,390 --> 00:12:09,920
So in that case, you first would have to design a class a blueprint.

155
00:12:09,980 --> 00:12:18,440
Define the methods in that blueprint and then use that class to create actual windows.

156
00:12:19,250 --> 00:12:21,290
And you do the same for buttons.

157
00:12:21,290 --> 00:12:26,810
You would write a class for a button and then have that class create buttons.

158
00:12:29,120 --> 00:12:34,640
But there are two things you should know about designing a new class.

159
00:12:34,670 --> 00:12:36,590
First is that.

160
00:12:38,000 --> 00:12:44,870
Most of the time these classes have been designed by other programmers, so all they have to do is just

161
00:12:44,870 --> 00:12:47,330
use them to create instances.

162
00:12:47,330 --> 00:12:54,800
So just like we had the case with lists and dictionaries and strings, these are already designed.

163
00:12:54,800 --> 00:12:55,820
We can just.

164
00:12:57,660 --> 00:12:59,520
Create instances of them.

165
00:13:00,930 --> 00:13:09,420
However, I'm going to cover how to create classes later in the course, and we're going to go a lot

166
00:13:09,420 --> 00:13:10,170
in depth.

167
00:13:11,120 --> 00:13:14,630
So basically you are going to be the God of your program.

168
00:13:14,630 --> 00:13:16,340
So you're going to design.

169
00:13:17,670 --> 00:13:24,210
Objects, and then you're going to create object instances from your blueprints, from your classes.

170
00:13:25,830 --> 00:13:32,520
So those are the two things I wanted to tell you that most of the time other people have designed these

171
00:13:32,520 --> 00:13:39,330
things, classes and the second words that you're going to learn how to design them in the course later

172
00:13:39,330 --> 00:13:39,660
on.

173
00:13:41,460 --> 00:13:48,840
Therefore, classes still remain a mystery for now, and that's completely fine.

174
00:13:48,870 --> 00:13:53,850
Methods also remain a mystery for you, so you know how.

175
00:13:56,530 --> 00:13:59,170
Function blueprints look like.

176
00:13:59,170 --> 00:14:04,760
But you still don't know how class blueprints and method blueprints look like.

177
00:14:04,780 --> 00:14:11,160
So so far we have used functions as we did here with get to do parentheses.

178
00:14:11,470 --> 00:14:14,560
So that's how you you use that function.

179
00:14:16,660 --> 00:14:21,700
Then we also saw methods such as the append methods you use.

180
00:14:21,700 --> 00:14:26,050
It's here, but you still haven't seen how these methods are.

181
00:14:27,540 --> 00:14:28,740
From the inside.

182
00:14:28,740 --> 00:14:30,930
The blueprint of a methods.

183
00:14:33,210 --> 00:14:38,880
So the key concept to take from this video was the distinction between.

184
00:14:40,490 --> 00:14:47,840
Classes or types, in other words, and the instances that these classes create.

185
00:14:50,470 --> 00:14:55,270
If you understand that difference in your mind, then you are in good tracks.

186
00:14:55,720 --> 00:14:58,880
So that was about the anatomy of Python.

187
00:14:58,900 --> 00:14:59,620
Thanks a lot.

188
00:14:59,620 --> 00:15:01,090
And let's do some more videos.

189
00:15:01,120 --> 00:15:01,600
See you.

