1
00:00:00,000 --> 00:00:00,000
Hello guys.

2
00:00:00,000 --> 00:00:04,000
So we are going to continue the discussion with respect to Python programming language.

3
00:00:04,000 --> 00:00:10,000
Now in this first video we are going to probably discuss about syntax and semantics in Python.

4
00:00:10,000 --> 00:00:13,000
So I have given the video outline what all things we are going to cover over here.

5
00:00:13,000 --> 00:00:17,000
So first of all we are going to understand about single line comments and multi line comments.

6
00:00:18,000 --> 00:00:22,000
Uh, along with this we are going to understand what is the definition of syntax and semantics.

7
00:00:22,000 --> 00:00:25,000
And then uh we'll see basic syntax rules in Python.

8
00:00:25,000 --> 00:00:28,000
Then we'll also be understanding about semantics in Python.

9
00:00:29,000 --> 00:00:32,000
And what are the common syntax errors and how to avoid them.

10
00:00:32,000 --> 00:00:36,000
And we'll also be seeing a lot of practical code examples.

11
00:00:36,000 --> 00:00:36,000
Okay.

12
00:00:36,000 --> 00:00:39,000
Now first of all let's go ahead with the definition over here.

13
00:00:39,000 --> 00:00:46,000
So here you can clearly see that syntax refers to the set of rules that defines the combination of symbols

14
00:00:46,000 --> 00:00:50,000
that are considered to be correctly structured program in a language.

15
00:00:50,000 --> 00:00:54,000
In a simpler terms, syntax is about the correct arrangement of words and symbol in a code.

16
00:00:55,000 --> 00:01:01,000
Now understand when we are doing coding right, uh, we usually face some kind of syntax error.

17
00:01:01,000 --> 00:01:04,000
Why it usually happens.

18
00:01:04,000 --> 00:01:08,000
It may be because let's say I'm not assigned a variable and I've directly used it, you know, so I

19
00:01:08,000 --> 00:01:10,000
may get a syntax error.

20
00:01:10,000 --> 00:01:14,000
So that is the reason it is written over here, that it is a correct arrangement of words and symbols

21
00:01:14,000 --> 00:01:15,000
in a code.

22
00:01:15,000 --> 00:01:15,000
Right.

23
00:01:15,000 --> 00:01:20,000
Now, uh, this is a basic definition of syntax.

24
00:01:20,000 --> 00:01:24,000
I would also like to give you some more definition for semantics.

25
00:01:24,000 --> 00:01:25,000
Okay.

26
00:01:25,000 --> 00:01:27,000
So let's go ahead and write it over here.

27
00:01:27,000 --> 00:01:32,000
So here you can see semantics refers to the meaning or interpretation of the symbol character and commands

28
00:01:32,000 --> 00:01:33,000
in a language.

29
00:01:33,000 --> 00:01:36,000
It is about what the code is supposed to do and it runs.

30
00:01:36,000 --> 00:01:44,000
Syntax is how we are able to arrange the words so that we write a code and semantics refers to the interpretation.

31
00:01:44,000 --> 00:01:51,000
So whatever code, we are specifically writing what it is supposed to do right when it runs, like when

32
00:01:51,000 --> 00:01:55,000
we are trying to run it, what it is supposed to do, it is more about the task that we are trying to

33
00:01:55,000 --> 00:01:56,000
do, right?

34
00:01:56,000 --> 00:01:58,000
And that is what semantics basically refer to.

35
00:01:59,000 --> 00:02:01,000
Now this is some kind of basic definition.

36
00:02:01,000 --> 00:02:07,000
I know you usually don't go through this, but, uh, I really wanted to explain you in a way that a

37
00:02:07,000 --> 00:02:12,000
basic anyone can actually be able to understand this who is also starting Python programming language?

38
00:02:12,000 --> 00:02:25,000
Okay, now let's go ahead and see some of the basic syntax in Basic syntax rules in Python.

39
00:02:25,000 --> 00:02:26,000
Okay.

40
00:02:26,000 --> 00:02:32,000
Now first first and the foremost important thing is about case sensitivity.

41
00:02:33,000 --> 00:02:33,000
Okay.

42
00:02:33,000 --> 00:02:35,000
So I'm going to write a comment over here.

43
00:02:35,000 --> 00:02:37,000
Case sensitivity.

44
00:02:37,000 --> 00:02:43,000
Now before I go ahead you'll be able to see that whenever I use double hash in a code.

45
00:02:43,000 --> 00:02:44,000
Uh, see, whenever we create a coding cell.

46
00:02:44,000 --> 00:02:45,000
Right.

47
00:02:45,000 --> 00:02:50,000
And if I want to write some kind of comments, a single line comment, I can basically use this double

48
00:02:50,000 --> 00:02:50,000
hash.

49
00:02:51,000 --> 00:02:56,000
So this double hash basically means that whenever I want to use a single line comment, I can just use

50
00:02:56,000 --> 00:02:56,000
this.

51
00:02:56,000 --> 00:02:58,000
And I can write any kind of comments that I want.

52
00:02:58,000 --> 00:02:59,000
Like I have written over here.

53
00:03:00,000 --> 00:03:04,000
Let's say that in this code cell I'm going to discuss about basic syntax rules in Python.

54
00:03:04,000 --> 00:03:06,000
So I have just written double hash over here okay.

55
00:03:07,000 --> 00:03:11,000
Let's say and there is also an option to use multi-line comments okay.

56
00:03:11,000 --> 00:03:12,000
Now multi-line comments.

57
00:03:12,000 --> 00:03:15,000
Let's say that I have created one test.py file over here.

58
00:03:15,000 --> 00:03:18,000
Now for multi-line comment let's say I'll write.

59
00:03:18,000 --> 00:03:24,000
this is a multi-line comment or sorry, this double hash is a single line comment.

60
00:03:24,000 --> 00:03:28,000
And in case of multi line comment I have to use triple quotes right.

61
00:03:28,000 --> 00:03:30,000
Something like this triple quotes.

62
00:03:30,000 --> 00:03:37,000
So I will say welcome to the right to the Python course.

63
00:03:37,000 --> 00:03:39,000
So that basically means I'm using 2 to 3 lines.

64
00:03:39,000 --> 00:03:40,000
And I'm writing this particular lines.

65
00:03:40,000 --> 00:03:40,000
Right.

66
00:03:40,000 --> 00:03:43,000
I'm, I'm, I'm giving some kind of comments over here.

67
00:03:43,000 --> 00:03:49,000
Now whenever I have comments which, which expands to multiple lines, I can definitely use this triple

68
00:03:49,000 --> 00:03:49,000
quotes.

69
00:03:49,000 --> 00:03:55,000
So these are the two ways of writing comments in Python programming language okay.

70
00:03:55,000 --> 00:04:03,000
The reason, uh, why I have used this test dot p, y and c again in Python, you can actually use ipynb

71
00:04:03,000 --> 00:04:08,000
file, which is the Jupyter notebook file, or.py file, which is a Python file Now, uh, this triple

72
00:04:08,000 --> 00:04:11,000
quotes usually does not work in Jupyter notebook.

73
00:04:11,000 --> 00:04:14,000
It only works in test.py file, right?

74
00:04:14,000 --> 00:04:19,000
Other than that, single line comments definitely work for both Jupyter notebook and the py file.

75
00:04:19,000 --> 00:04:21,000
Basically the python file.

76
00:04:21,000 --> 00:04:26,000
So I hope you got an idea of understanding about single line comments and multi line comments.

77
00:04:27,000 --> 00:04:30,000
Now let's go ahead and see some of the basic syntax in Python.

78
00:04:31,000 --> 00:04:35,000
So first point that I really want to talk about is case sensitivity.

79
00:04:36,000 --> 00:04:44,000
And to give you a good comment over here Python is case sensitive.

80
00:04:44,000 --> 00:04:47,000
So guys now let me go ahead and define a variable.

81
00:04:47,000 --> 00:04:50,000
Let's say this is a variable.

82
00:04:50,000 --> 00:04:52,000
Um and what exactly is a variable.

83
00:04:52,000 --> 00:04:53,000
Again I will give a definition.

84
00:04:53,000 --> 00:04:57,000
But let's consider that a variable is something that stores some information.

85
00:04:57,000 --> 00:04:57,000
Okay.

86
00:04:58,000 --> 00:05:01,000
Let's say in this particular variable I define my name.

87
00:05:01,000 --> 00:05:02,000
That is Chris okay.

88
00:05:03,000 --> 00:05:09,000
And let's say I again define a variable with capital n and I write the same variable name that is name.

89
00:05:10,000 --> 00:05:13,000
And here let's say that I am just going to use another name.

90
00:05:13,000 --> 00:05:14,000
Let's say Nick okay.

91
00:05:15,000 --> 00:05:24,000
Now one thing that you really need to know if I print this particular name and if I print the next name

92
00:05:25,000 --> 00:05:26,000
right over here.

93
00:05:26,000 --> 00:05:30,000
Both this name are different variables, right?

94
00:05:30,000 --> 00:05:34,000
It is not the same variable, even though even though the variable meaning is same.

95
00:05:34,000 --> 00:05:34,000
Right.

96
00:05:34,000 --> 00:05:35,000
Name name.

97
00:05:35,000 --> 00:05:36,000
Right.

98
00:05:36,000 --> 00:05:40,000
But I've told over here that Python is case sensitive, right?

99
00:05:40,000 --> 00:05:45,000
That basically means both these variable are different identifiers.

100
00:05:45,000 --> 00:05:46,000
Okay.

101
00:05:46,000 --> 00:05:51,000
So if I am going to execute this here, you can see the first name is displaying Krish and the second

102
00:05:51,000 --> 00:05:52,000
name is displaying Nayak.

103
00:05:52,000 --> 00:05:53,000
Right.

104
00:05:53,000 --> 00:05:58,000
So that is the reason we say that hey python is case sensitive right.

105
00:05:58,000 --> 00:05:59,000
Both this variable.

106
00:05:59,000 --> 00:06:00,000
Right.

107
00:06:00,000 --> 00:06:06,000
If you are writing, we always need to make sure that, uh, you know, let's say that, uh, I have

108
00:06:06,000 --> 00:06:11,000
defined this name over here and again, I've defined name, uh, unless and until both this, both this

109
00:06:11,000 --> 00:06:14,000
variable are having that case sensitive things.

110
00:06:14,000 --> 00:06:14,000
Right.

111
00:06:14,000 --> 00:06:20,000
That basically means if I, even though I'm writing with the small, uh, small n later letter over

112
00:06:20,000 --> 00:06:24,000
here, then I will be considering both this variable as same.

113
00:06:24,000 --> 00:06:26,000
Otherwise this will be treated as a different identifier.

114
00:06:26,000 --> 00:06:27,000
Right.

115
00:06:27,000 --> 00:06:29,000
So this is one of the very much important information.

116
00:06:29,000 --> 00:06:31,000
Now coming to the second thing right.

117
00:06:31,000 --> 00:06:37,000
Second point, let's talk about something called as indentation right now.

118
00:06:37,000 --> 00:06:39,000
What exactly is indentation okay.

119
00:06:39,000 --> 00:06:41,000
And this is also very much important to understand.

120
00:06:42,000 --> 00:06:44,000
I'll just write a comment over here.

121
00:06:44,000 --> 00:06:48,000
Python uses indentation to define blocks of code.

122
00:06:48,000 --> 00:06:50,000
Consistent use of space.

123
00:06:50,000 --> 00:06:53,000
Commonly four spaces or a tab is required.

124
00:06:53,000 --> 00:06:55,000
Okay, now what exactly is indentation?

125
00:06:55,000 --> 00:06:56,000
Okay.

126
00:06:56,000 --> 00:07:01,000
And, uh, if you really want to have a definition for indentation.

127
00:07:01,000 --> 00:07:02,000
Okay.

128
00:07:02,000 --> 00:07:05,000
Uh, so we can also define indentation over here.

129
00:07:05,000 --> 00:07:08,000
So let me just go ahead and give you some kind of definition okay.

130
00:07:08,000 --> 00:07:10,000
I will be using a markdown cell.

131
00:07:10,000 --> 00:07:13,000
And let me just go ahead and write over here right.

132
00:07:13,000 --> 00:07:16,000
And let's go through this particular indentation definition.

133
00:07:18,000 --> 00:07:20,000
So let me just go ahead and execute.

134
00:07:20,000 --> 00:07:24,000
Indentation in Python is used to define the structure and hierarchy of the code.

135
00:07:24,000 --> 00:07:31,000
Unlike many other programming language that uses braces to delimit block of codes, right, Python uses

136
00:07:31,000 --> 00:07:34,000
indentation to determine the grouping of statement.

137
00:07:34,000 --> 00:07:40,000
Okay, now indentation is something that is very much necessary whenever you are writing some clauses.

138
00:07:40,000 --> 00:07:44,000
Let's say if block or for loop or something else.

139
00:07:44,000 --> 00:07:44,000
Right.

140
00:07:44,000 --> 00:07:48,000
So let's say I'll give you an example over here, I will I will define a variable.

141
00:07:48,000 --> 00:07:50,000
Let's say age is equal to 32.

142
00:07:50,000 --> 00:07:53,000
And let me just go ahead and write one if condition.

143
00:07:53,000 --> 00:07:56,000
Don't worry if you don't know about if condition how do we write it?

144
00:07:56,000 --> 00:07:57,000
What is the syntax and all?

145
00:07:57,000 --> 00:08:04,000
I will, uh, explain this as we go ahead, but I just want to give you an idea about indentation.

146
00:08:04,000 --> 00:08:08,000
So let's say if I write if age is equal to greater than 30.

147
00:08:09,000 --> 00:08:14,000
Now when I write, if age is greater than 30, and if I just use this colon now see what will happen

148
00:08:14,000 --> 00:08:20,000
if I press enter, it is going to start inside this particular block and automatically it did not start

149
00:08:20,000 --> 00:08:21,000
from here.

150
00:08:21,000 --> 00:08:23,000
Instead it started from here.

151
00:08:23,000 --> 00:08:23,000
Right?

152
00:08:23,000 --> 00:08:26,000
So it is what it is basically doing.

153
00:08:26,000 --> 00:08:28,000
It is using indentation, right?

154
00:08:28,000 --> 00:08:31,000
It is using consistent use of space commonly for or tab.

155
00:08:31,000 --> 00:08:32,000
Right.

156
00:08:32,000 --> 00:08:35,000
And here it is for a block of statement right.

157
00:08:35,000 --> 00:08:37,000
Block of code right.

158
00:08:37,000 --> 00:08:44,000
So here if I'm going to right let's say that I'm going to print 30 over here I'm just going to print

159
00:08:44,000 --> 00:08:50,000
age right now what is basically happening over here I've just used this uh, if block.

160
00:08:50,000 --> 00:08:51,000
Right.

161
00:08:51,000 --> 00:08:56,000
And because of indentation, we know that this code is only going to get executed when this is true.

162
00:08:56,000 --> 00:08:57,000
Okay.

163
00:08:57,000 --> 00:09:03,000
If I go ahead outside and if I print it print age, that basically means this is not inside the if clause,

164
00:09:03,000 --> 00:09:04,000
right?

165
00:09:04,000 --> 00:09:08,000
Usually in other programming languages, we usually write this kind of braces.

166
00:09:08,000 --> 00:09:08,000
Right?

167
00:09:08,000 --> 00:09:10,000
We we try to define this kind of braces.

168
00:09:10,000 --> 00:09:14,000
If you know other programming languages like C plus plus or C sharp.

169
00:09:14,000 --> 00:09:14,000
Right.

170
00:09:14,000 --> 00:09:20,000
But in Python, instead of using this braces automatically it will be aligned with indentation.

171
00:09:20,000 --> 00:09:22,000
Now let me just go ahead and execute it.

172
00:09:22,000 --> 00:09:23,000
This time.

173
00:09:23,000 --> 00:09:25,000
Two times is basically getting displayed 32.

174
00:09:25,000 --> 00:09:27,000
So one is this and the other one is over here.

175
00:09:27,000 --> 00:09:32,000
Understand this age is basically getting displayed but this is outside the if block okay.

176
00:09:33,000 --> 00:09:39,000
So this is giving you an idea about indentation okay I've already explained you about comments, but

177
00:09:39,000 --> 00:09:42,000
let me just go ahead and write about single comments.

178
00:09:42,000 --> 00:09:43,000
So first single comment.

179
00:09:43,000 --> 00:09:45,000
Let's say this is a single line comment.

180
00:09:45,000 --> 00:09:48,000
I'll go ahead and write single line comment.

181
00:09:50,000 --> 00:09:54,000
Let's say that I'm going to print Hello World.

182
00:09:55,000 --> 00:09:59,000
Okay, now if I go ahead and execute this, you can see only Hello World is getting displayed.

183
00:09:59,000 --> 00:10:05,000
This this comment section is not getting printed right again, why do we write comments?

184
00:10:05,000 --> 00:10:06,000
Let's say that I want to define a function.

185
00:10:06,000 --> 00:10:08,000
I want to give some information about this particular function.

186
00:10:08,000 --> 00:10:11,000
I can write all those info in this comment section.

187
00:10:11,000 --> 00:10:11,000
Okay.

188
00:10:12,000 --> 00:10:14,000
Now, uh, this is important.

189
00:10:14,000 --> 00:10:14,000
Okay.

190
00:10:14,000 --> 00:10:18,000
Now let me just go ahead and talk more about different, different syntaxes.

191
00:10:18,000 --> 00:10:22,000
One more syntax is something called as line continuation.

192
00:10:22,000 --> 00:10:25,000
So here I'm going to basically write line continuation.

193
00:10:26,000 --> 00:10:29,000
Now what exactly is line continuation okay.

194
00:10:30,000 --> 00:10:33,000
Let's say I am going to create a variable total okay.

195
00:10:33,000 --> 00:10:42,000
And I'm doing some mathematical operation like one plus two plus three plus four plus five plus six

196
00:10:42,000 --> 00:10:43,000
plus seven.

197
00:10:43,000 --> 00:10:46,000
Let's say this line is becoming bigger and bigger, right?

198
00:10:46,000 --> 00:10:48,000
So this line is really becoming bigger and bigger.

199
00:10:48,000 --> 00:10:50,000
Let's say I want to go to the next line.

200
00:10:50,000 --> 00:10:55,000
So what I can actually do, let's say I will write plus and now I will use a black slash.

201
00:10:55,000 --> 00:10:59,000
Now if I use a backslash if I press enter then what is going to happen?

202
00:10:59,000 --> 00:11:01,000
It is just going to continue in the new line.

203
00:11:01,000 --> 00:11:06,000
Okay, so here I will just use this and then let me go ahead and press backslash.

204
00:11:06,000 --> 00:11:11,000
And let's say I go ahead and add more elements like four plus five plus six.

205
00:11:11,000 --> 00:11:17,000
Now if I go ahead and print total you will be able to see this will also do all the operation.

206
00:11:17,000 --> 00:11:29,000
So if I do the calculation 1318, 22, 25, 27, 28, 28 and uh 28, plus six, 34 3943.

207
00:11:29,000 --> 00:11:30,000
Right.

208
00:11:30,000 --> 00:11:39,000
And I'm able to get the answer so you can use right in case of uh, basically line continuation, you

209
00:11:39,000 --> 00:11:41,000
can basically use a backslash.

210
00:11:41,000 --> 00:11:42,000
Right.

211
00:11:42,000 --> 00:11:45,000
And you can continue the statement to the next line.

212
00:11:45,000 --> 00:11:46,000
Okay.

213
00:11:46,000 --> 00:11:47,000
So this is very much important.

214
00:11:47,000 --> 00:11:49,000
Again one of the most amazing feature.

215
00:11:50,000 --> 00:11:53,000
And again let me just show you one more thing.

216
00:11:53,000 --> 00:11:56,000
One more amazing thing with respect to syntax and semantics.

217
00:11:56,000 --> 00:12:01,000
Uh, that is nothing but multiple statements on a single line.

218
00:12:03,000 --> 00:12:04,000
On a single line.

219
00:12:04,000 --> 00:12:05,000
Now, what does this basically mean?

220
00:12:05,000 --> 00:12:08,000
Let's say I want to assign one value.

221
00:12:08,000 --> 00:12:09,000
Let's say x is equal to five.

222
00:12:09,000 --> 00:12:11,000
I have defined I want to define another variable.

223
00:12:11,000 --> 00:12:13,000
Let's say y is equal to ten.

224
00:12:13,000 --> 00:12:16,000
Again if I want to define another variable I'll use a colon.

225
00:12:17,000 --> 00:12:19,000
And I'll go ahead and write x is equal to x plus y.

226
00:12:20,000 --> 00:12:25,000
Now what is basically happening in a single line of uh in a single line I've used multiple statement

227
00:12:25,000 --> 00:12:28,000
I have assigned x is equal to five, y is equal to ten, Z is equal to x plus y.

228
00:12:28,000 --> 00:12:35,000
Now if I go ahead and print z you see I will be able to get the answer.

229
00:12:35,000 --> 00:12:37,000
See ten plus five is equal to nothing but 15 right?

230
00:12:38,000 --> 00:12:42,000
So guys now you here you can see that this kind of operation can also be performed right.

231
00:12:42,000 --> 00:12:46,000
Now let's go ahead and understand semantics okay.

232
00:12:47,000 --> 00:12:49,000
And here also I'm going to put some points.

233
00:12:49,000 --> 00:12:52,000
So understanding semantics in Python.

234
00:12:54,000 --> 00:12:54,000
Okay.

235
00:12:55,000 --> 00:12:59,000
Now the first thing uh that we are going to understand is about variable assignment.

236
00:12:59,000 --> 00:13:03,000
So what exactly is variable assignment?

237
00:13:03,000 --> 00:13:08,000
Let's say that I define a variable like age is equal to 32.

238
00:13:08,000 --> 00:13:08,000
Okay.

239
00:13:09,000 --> 00:13:13,000
So here when we run this particular command right.

240
00:13:13,000 --> 00:13:19,000
When we run this line of code then in other programming language you usually define the data type beforehand

241
00:13:19,000 --> 00:13:21,000
like int age float age.

242
00:13:21,000 --> 00:13:27,000
But here in Python the kernel automatically understands during the runtime.

243
00:13:27,000 --> 00:13:32,000
So here the kernel will understand that age is an integer, because here we are assigning some integer

244
00:13:32,000 --> 00:13:33,000
value.

245
00:13:33,000 --> 00:13:37,000
Similarly, let's say I go ahead and write name is equal to Chris.

246
00:13:38,000 --> 00:13:41,000
So here you'll be able to see that name will be a string right.

247
00:13:41,000 --> 00:13:43,000
So name is a string.

248
00:13:43,000 --> 00:13:45,000
So I will just go ahead and execute this.

249
00:13:46,000 --> 00:13:51,000
If you want to understand whether I am probably how to probably check the type of this.

250
00:13:51,000 --> 00:13:55,000
So I will go ahead and write type of H and let me just go ahead and execute it.

251
00:13:55,000 --> 00:13:58,000
So here you'll be able to see that hey I'm getting an integer value.

252
00:13:59,000 --> 00:14:01,000
So this basically indicates that h is an integer.

253
00:14:01,000 --> 00:14:05,000
Then if I go ahead and execute type off name.

254
00:14:05,000 --> 00:14:09,000
So here you'll be able to see that hey it is an HDR type that is nothing but string type.

255
00:14:10,000 --> 00:14:13,000
Now uh, let me do one thing.

256
00:14:13,000 --> 00:14:14,000
Okay.

257
00:14:15,000 --> 00:14:19,000
Uh, this the type that we have actually run, right?

258
00:14:19,000 --> 00:14:22,000
It is also called as something called as type inferencing.

259
00:14:23,000 --> 00:14:26,000
So here I'm going to basically write type inference.

260
00:14:27,000 --> 00:14:32,000
Now Python infers the type of a variable at the runtime.

261
00:14:32,000 --> 00:14:35,000
And this is basically allowing dynamic typing okay.

262
00:14:35,000 --> 00:14:38,000
So what does it basically mean over here.

263
00:14:38,000 --> 00:14:43,000
Is that uh, okay, I will just use this in the other code.

264
00:14:43,000 --> 00:14:44,000
Let's see.

265
00:14:45,000 --> 00:14:48,000
So if I go ahead and write over here I'll create a variable.

266
00:14:48,000 --> 00:14:50,000
Variable is equal to ten okay.

267
00:14:50,000 --> 00:14:58,000
And let's say I go ahead and write print type of var write as.

268
00:14:58,000 --> 00:15:00,000
Sorry this will be variable okay.

269
00:15:00,000 --> 00:15:02,000
Now what is basically going to happen over here?

270
00:15:02,000 --> 00:15:08,000
Once you probably execute this you are able to get an answer saying that hey, it is of int type and

271
00:15:08,000 --> 00:15:10,000
the class will be int okay.

272
00:15:10,000 --> 00:15:17,000
But if I go ahead and use the same variable and assign some other name or some other value, let's say

273
00:15:17,000 --> 00:15:18,000
Chris.

274
00:15:19,000 --> 00:15:26,000
Now if I go ahead and print the type of variable now what I am actually going to get right.

275
00:15:26,000 --> 00:15:31,000
So here you'll be able to see that I will be able to get SDR for the same variable itself.

276
00:15:31,000 --> 00:15:32,000
Right.

277
00:15:32,000 --> 00:15:38,000
So here you'll be able to see that whenever we refer to the type of this specific variable, we will

278
00:15:38,000 --> 00:15:42,000
be also able to see something very amazing as we keep on changing.

279
00:15:42,000 --> 00:15:46,000
This particular variable will be also able to see the inferencing type.

280
00:15:46,000 --> 00:15:46,000
Right.

281
00:15:46,000 --> 00:15:50,000
So basically when we are searching for type of this it is basically showing different different things.

282
00:15:50,000 --> 00:15:55,000
So that basically means what during the runtime you can change the type of the variable with different

283
00:15:55,000 --> 00:15:56,000
different values.

284
00:15:56,000 --> 00:15:57,000
Okay.

285
00:15:58,000 --> 00:16:02,000
Now uh this was one of the most amazing thing, uh, with respect to semantics.

286
00:16:02,000 --> 00:16:03,000
Okay.

287
00:16:03,000 --> 00:16:09,000
Um, and uh, as, as, you know, something, uh, over here is that we also need to understand that

288
00:16:09,000 --> 00:16:14,000
what happens, uh, in the case of indentation error, let's say if I go ahead and write, age is equal

289
00:16:14,000 --> 00:16:14,000
to 32.

290
00:16:14,000 --> 00:16:19,000
And if I write if age is greater than 30, okay.

291
00:16:19,000 --> 00:16:23,000
And if I go ahead and execute it and let's say I don't use this indentation.

292
00:16:23,000 --> 00:16:26,000
Instead I start from here and I go ahead and write print age.

293
00:16:26,000 --> 00:16:32,000
So here clearly you'll be getting an error saying that hey indentation error expected and indented block

294
00:16:32,000 --> 00:16:34,000
after if statement on line two.

295
00:16:34,000 --> 00:16:36,000
So this is how you will be able to understand it.

296
00:16:36,000 --> 00:16:40,000
All I have to do is that start from this and automatically you'll be able to see the answer.

297
00:16:41,000 --> 00:16:44,000
Okay, uh, this is important.

298
00:16:44,000 --> 00:16:46,000
Uh, otherwise, uh, understand?

299
00:16:46,000 --> 00:16:48,000
Without indentation, things will not work out.

300
00:16:48,000 --> 00:16:53,000
Even though you create classes, even though you create functions, whenever you write a block of codes

301
00:16:53,000 --> 00:16:58,000
within some kind of blocks itself, like an if statement for loop or while loop.

302
00:16:58,000 --> 00:17:00,000
So indentation is specifically required there.

303
00:17:00,000 --> 00:17:03,000
You do not explicitly need to use brackets.

304
00:17:04,000 --> 00:17:09,000
Now, uh, one more thing, one more syntax error, which usually people do.

305
00:17:09,000 --> 00:17:13,000
Let's say I have defined a is equal to B and you know that B is not defined.

306
00:17:13,000 --> 00:17:16,000
So if I go ahead and execute this this is also kind of syntax error.

307
00:17:16,000 --> 00:17:18,000
Because name B is not defined over here.

308
00:17:18,000 --> 00:17:18,000
Right.

309
00:17:18,000 --> 00:17:21,000
So this basically becomes a unknown variable.

310
00:17:21,000 --> 00:17:22,000
Right.

311
00:17:22,000 --> 00:17:27,000
So this is nothing but this is basically called as a name error.

312
00:17:27,000 --> 00:17:28,000
Okay.

313
00:17:28,000 --> 00:17:33,000
I'll be showing you as we go ahead, uh, with respect to exception handling and how do we handle all

314
00:17:33,000 --> 00:17:34,000
these things?

315
00:17:34,000 --> 00:17:35,000
We'll be talking more about it.

316
00:17:35,000 --> 00:17:36,000
Okay.

317
00:17:36,000 --> 00:17:38,000
Now, uh, let me do one thing.

318
00:17:38,000 --> 00:17:42,000
Uh, let me just show you one amazing example of indentation.

319
00:17:42,000 --> 00:17:45,000
Some code example of indentations.

320
00:17:45,000 --> 00:17:45,000
Okay.

321
00:17:46,000 --> 00:17:52,000
And again, uh, after this session, also, I will be giving you a lot of, uh, quizzes, assignments,

322
00:17:52,000 --> 00:17:54,000
practice, uh, sessions and all.

323
00:17:54,000 --> 00:17:56,000
You just need to go ahead and do it.

324
00:17:56,000 --> 00:17:56,000
Okay.

325
00:17:56,000 --> 00:17:57,000
Practice it.

326
00:17:57,000 --> 00:18:02,000
So here, if I write if true, say true is a kind of a boolean variable, I will be talking more about

327
00:18:02,000 --> 00:18:03,000
variables in our next session.

328
00:18:03,000 --> 00:18:05,000
Let's say I go ahead and print.

329
00:18:06,000 --> 00:18:08,000
This is my correct indentation.

330
00:18:08,000 --> 00:18:09,000
Right.

331
00:18:09,000 --> 00:18:10,000
Indentation.

332
00:18:10,000 --> 00:18:14,000
So here uh this this basically becomes my statement.

333
00:18:14,000 --> 00:18:18,000
And print is just to print anything in your output console okay.

334
00:18:18,000 --> 00:18:22,000
Now inside this true let's say I have another condition if false.

335
00:18:22,000 --> 00:18:28,000
Now if I want to write any print statement inside this block, then I have to again do an indentation.

336
00:18:28,000 --> 00:18:29,000
So here we go ahead and write.

337
00:18:29,000 --> 00:18:32,000
Print this one print.

338
00:18:32,000 --> 00:18:34,000
Write this one print.

339
00:18:34,000 --> 00:18:36,000
Why it will not print because by default it is true.

340
00:18:36,000 --> 00:18:38,000
This is going to print.

341
00:18:38,000 --> 00:18:42,000
It is going to check this condition and it's going to come out of this particular condition.

342
00:18:42,000 --> 00:18:43,000
Right.

343
00:18:43,000 --> 00:18:48,000
And finally you'll be able to see that I'm printing one more thing over here saying that whether this

344
00:18:48,000 --> 00:18:52,000
will print or not, you just think, okay, this will obviously print, right?

345
00:18:52,000 --> 00:18:54,000
Because this is not getting executed.

346
00:18:54,000 --> 00:18:55,000
We are not going inside this.

347
00:18:55,000 --> 00:18:57,000
And finally, this print statement will execute.

348
00:18:57,000 --> 00:19:03,000
Now, if I want to go outside the if clause, then this will be another print statement.

349
00:19:03,000 --> 00:19:03,000
Right?

350
00:19:03,000 --> 00:19:08,000
And I can basically say outside the if block.

351
00:19:09,000 --> 00:19:14,000
So how many times print is going to, uh, just pause the video and understand how many times the print

352
00:19:14,000 --> 00:19:15,000
statement is going to execute it, right?

353
00:19:15,000 --> 00:19:16,000
Three times.

354
00:19:16,000 --> 00:19:19,000
So if I go ahead and execute it, you'll be able to see correct indentation.

355
00:19:19,000 --> 00:19:22,000
This will print outside the if block okay.

356
00:19:22,000 --> 00:19:24,000
So this is basically going to get printed right.

357
00:19:24,000 --> 00:19:28,000
So these are some of the amazing examples of indentation.

358
00:19:28,000 --> 00:19:28,000
Okay.

359
00:19:30,000 --> 00:19:31,000
Now uh, let me do one thing.

360
00:19:31,000 --> 00:19:33,000
Let me show you one more thing.

361
00:19:33,000 --> 00:19:34,000
Right.

362
00:19:34,000 --> 00:19:40,000
Um, one is with respect to, uh, correct variable assignment and, uh, type inference.

363
00:19:40,000 --> 00:19:45,000
But before I go ahead and explain you more about this, uh, this is some basics about syntax and semantics.

364
00:19:46,000 --> 00:19:49,000
Uh, now, as we go ahead, uh, what all things we basically covered single line comments, multi line

365
00:19:49,000 --> 00:19:51,000
comments, definition, syntax and semantics.

366
00:19:51,000 --> 00:19:53,000
Basic syntax rules.

367
00:19:53,000 --> 00:19:55,000
How do you define a variable?

368
00:19:55,000 --> 00:19:59,000
What are scans are case sensitive and all everything I've actually covered over here.

369
00:19:59,000 --> 00:20:00,000
Right.

370
00:20:00,000 --> 00:20:06,000
This actually gives you an idea about uh, you know, the basic differences between syntax and semantics

371
00:20:06,000 --> 00:20:06,000
also.

372
00:20:06,000 --> 00:20:08,000
So I hope you like this particular video.

373
00:20:08,000 --> 00:20:13,000
In the next video I am going to talk about, uh, variables, then data types, then operators.

374
00:20:13,000 --> 00:20:14,000
Right.

375
00:20:14,000 --> 00:20:15,000
So yes, this was it for my side.

376
00:20:15,000 --> 00:20:16,000
I will see you all in the next video.

377
00:20:16,000 --> 00:20:17,000
Thank you.

