1
00:00:00,000 --> 00:00:00,000
Hello guys.

2
00:00:00,000 --> 00:00:03,000
We are going to continue the discussion with respect to Python.

3
00:00:03,000 --> 00:00:05,000
And in this video we are going to talk about loops.

4
00:00:05,000 --> 00:00:10,000
Already in our previous video we have uh, we have seen a lot of examples with respect to conditional

5
00:00:10,000 --> 00:00:16,000
statements like if Elif else and we have seen multiple examples out there right now in loops, uh,

6
00:00:16,000 --> 00:00:22,000
we will be discussing about what are the different types of loop we usually use in Python programming

7
00:00:22,000 --> 00:00:27,000
language, like for loop while loop, uh, loop control statements like break, continue, and pass.

8
00:00:27,000 --> 00:00:31,000
Then we'll be discussing about nested loops, and then we'll be seeing like all these things.

9
00:00:31,000 --> 00:00:35,000
We will be seeing much more in with the help of practical examples.

10
00:00:35,000 --> 00:00:39,000
And what are the common errors we usually face and how to avoid those errors.

11
00:00:39,000 --> 00:00:42,000
So all these things will be discussing in this particular video.

12
00:00:42,000 --> 00:00:48,000
So first of all let's go ahead and work with for loop with a simple, uh, you know, syntax.

13
00:00:48,000 --> 00:00:53,000
So in order to write a for loop right you need to understand what a for loop is.

14
00:00:53,000 --> 00:00:55,000
A for loop is a loop, right?

15
00:00:55,000 --> 00:00:58,000
It is used to iterate over a sequence of numbers.

16
00:00:58,000 --> 00:00:58,000
Okay.

17
00:00:58,000 --> 00:01:05,000
So let's say I will give one example like for I okay I is just a temporary variable right now in let's

18
00:01:05,000 --> 00:01:07,000
say I want to create a sequence of numbers.

19
00:01:07,000 --> 00:01:12,000
Now in order to create a sequence of numbers, uh, I will show you with the help of range.

20
00:01:12,000 --> 00:01:12,000
Okay.

21
00:01:12,000 --> 00:01:14,000
So what exactly is range?

22
00:01:14,000 --> 00:01:14,000
Okay.

23
00:01:14,000 --> 00:01:18,000
So let's say in this particular range I give five elements.

24
00:01:18,000 --> 00:01:20,000
I basically want five elements over here.

25
00:01:20,000 --> 00:01:24,000
So this is turn actually help us to generate numbers between 0 to 5.

26
00:01:24,000 --> 00:01:24,000
Right.

27
00:01:24,000 --> 00:01:30,000
So here you can see that hey I'm getting a range uh between 0 to 5 over here.

28
00:01:30,000 --> 00:01:36,000
And let's say I want to just display all these numbers inside this right range is just giving us a sequence

29
00:01:36,000 --> 00:01:37,000
of numbers between 0 to 5.

30
00:01:37,000 --> 00:01:42,000
But if I want to iterate through this, all the numbers I can basically use for loop.

31
00:01:42,000 --> 00:01:46,000
So if I write for I in range five, right.

32
00:01:46,000 --> 00:01:52,000
And here if I go ahead and print I right now, you'll be seeing that after every iteration.

33
00:01:52,000 --> 00:01:58,000
First of all, when we are looping inside this sequence of numbers between 0 to 5, first it will go

34
00:01:58,000 --> 00:01:59,000
ahead and display zero.

35
00:01:59,000 --> 00:02:01,000
Then it will go ahead and display one.

36
00:02:01,000 --> 00:02:06,000
That basically means after every iteration, this number is basically getting incremented and it is

37
00:02:06,000 --> 00:02:08,000
traversing through all this range of numbers.

38
00:02:08,000 --> 00:02:14,000
One important thing that you should understand that since I've used range between 0 to 5, the last

39
00:02:14,000 --> 00:02:15,000
number is not going to get included.

40
00:02:15,000 --> 00:02:20,000
So that is the reason you can see zero is here, one is here, two is here, three is here, and four

41
00:02:20,000 --> 00:02:20,000
is here.

42
00:02:20,000 --> 00:02:21,000
Right.

43
00:02:21,000 --> 00:02:24,000
But the total number of elements is five over here and here.

44
00:02:24,000 --> 00:02:28,000
Uh, in short I've spoken about for loop and range as a function.

45
00:02:28,000 --> 00:02:28,000
Okay.

46
00:02:28,000 --> 00:02:34,000
So range as a function is also given Let's say I want to probably use for loop with different range

47
00:02:34,000 --> 00:02:34,000
of numbers.

48
00:02:34,000 --> 00:02:34,000
Right.

49
00:02:34,000 --> 00:02:40,000
Let's say if I go ahead and write one comma six, that basically means I want the number between 1 to

50
00:02:40,000 --> 00:02:40,000
6.

51
00:02:40,000 --> 00:02:42,000
Six is the last number.

52
00:02:42,000 --> 00:02:47,000
So we are not going to include it because at the end of the day, with respect to Python, whenever

53
00:02:47,000 --> 00:02:50,000
we are seeing indexing right, it always starts with zero, right.

54
00:02:50,000 --> 00:02:53,000
So uh, I'll talk more about it as I go ahead.

55
00:02:53,000 --> 00:02:57,000
Now, if I go ahead and execute this here, you'll be able to see one is getting displayed, two is

56
00:02:57,000 --> 00:03:00,000
getting displayed, three is getting displayed, four is getting displayed, five is getting displayed.

57
00:03:00,000 --> 00:03:07,000
So I can also call all my range of numbers with respect to or by giving a numbers between one number

58
00:03:07,000 --> 00:03:08,000
to the other number itself.

59
00:03:08,000 --> 00:03:13,000
Right now let me just give you more examples over here by using range.

60
00:03:13,000 --> 00:03:22,000
So if I go ahead and write range a range of one comma ten And let me just go ahead and give some third

61
00:03:22,000 --> 00:03:23,000
parameter.

62
00:03:23,000 --> 00:03:23,000
Right.

63
00:03:23,000 --> 00:03:27,000
So third parameter over here you'll be able to see that it is something called a step.

64
00:03:27,000 --> 00:03:29,000
Now see see the syntax.

65
00:03:29,000 --> 00:03:32,000
It shows start as the first parameter inside range function.

66
00:03:32,000 --> 00:03:34,000
Then you have the stop parameter.

67
00:03:34,000 --> 00:03:36,000
Then you have the step parameter okay.

68
00:03:36,000 --> 00:03:39,000
By default step parameter is usually given as one.

69
00:03:39,000 --> 00:03:44,000
Now start I'm saying hey start from one end till ten Right end before ten.

70
00:03:44,000 --> 00:03:46,000
I'll not say till ten, but before ten.

71
00:03:46,000 --> 00:03:49,000
And use the step size as one.

72
00:03:49,000 --> 00:03:51,000
That basically means only increment one number at a time.

73
00:03:51,000 --> 00:03:56,000
So if I go ahead and execute it, this will basically give me a range of value between 1 to 10.

74
00:03:56,000 --> 00:03:57,000
But and the step size will be one.

75
00:03:57,000 --> 00:04:00,000
Right now let me just go ahead and make it two okay.

76
00:04:00,000 --> 00:04:04,000
So here you can see that I'm starting from one before ten.

77
00:04:04,000 --> 00:04:04,000
It will stop.

78
00:04:04,000 --> 00:04:05,000
And here the range is two.

79
00:04:05,000 --> 00:04:08,000
That basically means the two numbers will get incremented.

80
00:04:08,000 --> 00:04:10,000
Now let me do one thing.

81
00:04:10,000 --> 00:04:10,000
Okay.

82
00:04:10,000 --> 00:04:16,000
Let me just write one over here and let me use a for loop again for I in range of this.

83
00:04:16,000 --> 00:04:18,000
And let me go ahead and print I.

84
00:04:18,000 --> 00:04:18,000
Okay.

85
00:04:18,000 --> 00:04:22,000
Now when I'm printing I you'll be able to see that what I'm actually getting.

86
00:04:22,000 --> 00:04:24,000
123456789.

87
00:04:24,000 --> 00:04:27,000
Now let me make this change from step size 1 to 2.

88
00:04:27,000 --> 00:04:28,000
Now what will happen?

89
00:04:28,000 --> 00:04:33,000
See, after one directly three will get displayed because we are going to skip one number.

90
00:04:33,000 --> 00:04:36,000
So it is just going to jump two steps ahead right now.

91
00:04:36,000 --> 00:04:37,000
See this.

92
00:04:37,000 --> 00:04:41,000
So now I can see 13579 right.

93
00:04:41,000 --> 00:04:46,000
So I am not probably traversing to each and every number, but instead I have given a step size of two.

94
00:04:46,000 --> 00:04:48,000
So it is jumping two numbers ahead.

95
00:04:48,000 --> 00:04:50,000
And that is how it is basically getting printed.

96
00:04:50,000 --> 00:04:52,000
Let me just show you one more example.

97
00:04:52,000 --> 00:04:59,000
Let's say that I want all the numbers between, um, 10 to 1.

98
00:04:59,000 --> 00:05:03,000
But now this time I will use a step size of minus one.

99
00:05:03,000 --> 00:05:07,000
Now what it is going to do, it is going to display a number between 10 to 1.

100
00:05:07,000 --> 00:05:09,000
And step size will be minus one.

101
00:05:09,000 --> 00:05:12,000
That basically means after ten it will become nine, then eight, then seven.

102
00:05:12,000 --> 00:05:12,000
See this.

103
00:05:12,000 --> 00:05:20,000
So here you can see 910 987654321 is not getting displayed as we know that last number will be skipped

104
00:05:20,000 --> 00:05:20,000
before this.

105
00:05:20,000 --> 00:05:22,000
all the numbers will be displayed.

106
00:05:22,000 --> 00:05:25,000
One more example that we if I really want to show it to you.

107
00:05:25,000 --> 00:05:26,000
So here you can see minus two.

108
00:05:26,000 --> 00:05:27,000
If I'm using minus two.

109
00:05:27,000 --> 00:05:31,000
So ten 86542642.

110
00:05:31,000 --> 00:05:31,000
Right.

111
00:05:31,000 --> 00:05:34,000
So I hope you have got an idea with respect to for loops.

112
00:05:34,000 --> 00:05:37,000
And with the help of range how we can actually move.

113
00:05:37,000 --> 00:05:38,000
Okay.

114
00:05:38,000 --> 00:05:42,000
Now let me show you with respect to strings I hope everybody has learned strings.

115
00:05:42,000 --> 00:05:43,000
Right.

116
00:05:43,000 --> 00:05:45,000
So strings uh how to properly create string.

117
00:05:45,000 --> 00:05:48,000
Let's say that this is my string okay.

118
00:05:48,000 --> 00:05:49,000
This is my string.

119
00:05:49,000 --> 00:05:51,000
And here I am going to write Krish Nayak.

120
00:05:51,000 --> 00:05:52,000
Okay.

121
00:05:52,000 --> 00:05:58,000
Now if I want to traverse to this particular string now see, one amazing thing about this data structure

122
00:05:58,000 --> 00:06:01,000
called a string is that we can traverse to each and every character over here.

123
00:06:01,000 --> 00:06:09,000
So if I go ahead and write for I in str, okay, and uh, for I in str.

124
00:06:09,000 --> 00:06:12,000
And if I just go ahead and print I okay.

125
00:06:12,000 --> 00:06:14,000
So string is basically a data structure.

126
00:06:14,000 --> 00:06:15,000
It is just nothing.

127
00:06:15,000 --> 00:06:17,000
But it is a collection of characters.

128
00:06:17,000 --> 00:06:20,000
Right now if I'm going to print over here, here you can see k r I s h.

129
00:06:20,000 --> 00:06:22,000
Then again space and I k right.

130
00:06:22,000 --> 00:06:27,000
Let's say that I, I'm traversing to this particular string.

131
00:06:27,000 --> 00:06:32,000
And I also want to do something like I may have a sentence I may have a paragraph.

132
00:06:32,000 --> 00:06:34,000
So based on that also I can print it over here.

133
00:06:34,000 --> 00:06:34,000
Right.

134
00:06:34,000 --> 00:06:40,000
Just to give you an idea what exactly this is, uh, because string is a collection of characters,

135
00:06:40,000 --> 00:06:41,000
right?

136
00:06:41,000 --> 00:06:42,000
It is a collection of characters.

137
00:06:42,000 --> 00:06:43,000
And we can also traverse thing.

138
00:06:43,000 --> 00:06:49,000
So the for loop main functionality is that whenever you have any collection items, like any collection

139
00:06:49,000 --> 00:06:54,000
data structure, you can traverse through it very much easily by just using a for loop.

140
00:06:54,000 --> 00:06:54,000
Right.

141
00:06:54,000 --> 00:06:56,000
So I've just given you an idea about it.

142
00:06:56,000 --> 00:07:01,000
But as we go ahead, we'll be seeing more complicated example, uh, as we go ahead.

143
00:07:01,000 --> 00:07:01,000
Right.

144
00:07:01,000 --> 00:07:05,000
But just to understand the basic example, this is what a for loop is all about.

145
00:07:05,000 --> 00:07:09,000
Now let's go ahead and discuss about something called as while loop okay.

146
00:07:09,000 --> 00:07:11,000
So while loop.

147
00:07:11,000 --> 00:07:15,000
So now let's see something about while loop.

148
00:07:16,000 --> 00:07:18,000
So now I have while loop okay.

149
00:07:18,000 --> 00:07:20,000
Now with respect to while loop right.

150
00:07:20,000 --> 00:07:28,000
If I really want to give a small definition, this while loop is nothing, but it continues to execute

151
00:07:28,000 --> 00:07:31,000
as long as the condition is true.

152
00:07:31,000 --> 00:07:36,000
Okay, that basically means unless and until this while loop whatever condition I'm writing in while

153
00:07:36,000 --> 00:07:39,000
loop, it is true it is just going to execute it.

154
00:07:39,000 --> 00:07:40,000
Okay, now let me do one thing.

155
00:07:40,000 --> 00:07:43,000
Let me create a temporary variable called as count.

156
00:07:43,000 --> 00:07:44,000
Okay.

157
00:07:44,000 --> 00:07:45,000
Count okay.

158
00:07:45,000 --> 00:07:52,000
Now with respect to this particular count, let me just go ahead and write while count is less than

159
00:07:52,000 --> 00:07:52,000
five.

160
00:07:54,000 --> 00:07:54,000
Okay.

161
00:07:54,000 --> 00:07:57,000
And now I have gone inside my while loop.

162
00:07:57,000 --> 00:07:59,000
Uh, while block or while loop over here.

163
00:07:59,000 --> 00:08:05,000
So I'm putting this particular condition unless until this count is not is less than five.

164
00:08:05,000 --> 00:08:07,000
Just go ahead and print it.

165
00:08:07,000 --> 00:08:08,000
Okay.

166
00:08:08,000 --> 00:08:11,000
Let's say I'm going to print the count okay.

167
00:08:11,000 --> 00:08:11,000
Okay.

168
00:08:11,000 --> 00:08:17,000
And after this, if I'm executing C, uh, I also need to increment the count over here.

169
00:08:17,000 --> 00:08:20,000
So I will go ahead and write count plus one okay.

170
00:08:20,000 --> 00:08:24,000
So what I'm doing unless and until this count is less than five, I'm going to print the count.

171
00:08:24,000 --> 00:08:28,000
And for every iteration, because we have initially initialized, count is equal to zero.

172
00:08:28,000 --> 00:08:31,000
For every iteration I am writing, count is equal to count plus one.

173
00:08:31,000 --> 00:08:34,000
Okay, now see what will happen if I execute this.

174
00:08:34,000 --> 00:08:36,000
You'll be seeing that zero is getting displayed.

175
00:08:36,000 --> 00:08:38,000
Initially, I will be having zero.

176
00:08:38,000 --> 00:08:40,000
So when I write while count is less than five, this is true.

177
00:08:40,000 --> 00:08:42,000
It is just going to print the count.

178
00:08:42,000 --> 00:08:43,000
So I'm going to get zero over here.

179
00:08:43,000 --> 00:08:46,000
And then it is going to increment the count.

180
00:08:46,000 --> 00:08:49,000
Now my temporary variable count will have one value right?

181
00:08:49,000 --> 00:08:54,000
I'll not say temporary, but uh my count value from this zero has got incremented to one.

182
00:08:54,000 --> 00:08:57,000
Then again this file while loop will run.

183
00:08:57,000 --> 00:08:57,000
Why?

184
00:08:57,000 --> 00:09:00,000
It will run because this condition is still true, right?

185
00:09:00,000 --> 00:09:03,000
So now here you can see when one is less than five.

186
00:09:03,000 --> 00:09:05,000
So one is obviously less than five in the second loop.

187
00:09:05,000 --> 00:09:06,000
So again this will get executed.

188
00:09:06,000 --> 00:09:08,000
Then again this will get incremented.

189
00:09:08,000 --> 00:09:09,000
Then again it will go to the next loop.

190
00:09:09,000 --> 00:09:11,000
Then this will become 234.

191
00:09:11,000 --> 00:09:12,000
Then.

192
00:09:12,000 --> 00:09:15,000
But once it becomes five right.

193
00:09:15,000 --> 00:09:17,000
While five is less than five now this becomes false.

194
00:09:17,000 --> 00:09:19,000
It is just going to come outside the loop, right?

195
00:09:19,000 --> 00:09:24,000
So that is how you are getting displayed with 01234.

196
00:09:24,000 --> 00:09:24,000
Right.

197
00:09:24,000 --> 00:09:30,000
So this is a simple way of probably displaying or understanding about the while loop.

198
00:09:30,000 --> 00:09:30,000
Okay.

199
00:09:30,000 --> 00:09:36,000
Uh, I may also write something like this while okay let's go ahead and write.

200
00:09:36,000 --> 00:09:38,000
Count is equal to zero okay.

201
00:09:40,000 --> 00:09:48,000
Count is equal to zero while count while count.

202
00:09:49,000 --> 00:09:51,000
Percentile two is double equal to zero.

203
00:09:52,000 --> 00:09:52,000
Okay.

204
00:09:52,000 --> 00:09:54,000
So now see this condition.

205
00:09:54,000 --> 00:09:59,000
What I'm saying while count percentile two is double equal to zero.

206
00:09:59,000 --> 00:10:04,000
If this is true right I will probably go ahead and print the count over here.

207
00:10:04,000 --> 00:10:05,000
Right.

208
00:10:05,000 --> 00:10:05,000
Right.

209
00:10:05,000 --> 00:10:11,000
And let's say that I will go ahead and or let me do one thing, okay.

210
00:10:11,000 --> 00:10:13,000
If I'm starting from count is equal to zero.

211
00:10:13,000 --> 00:10:17,000
And this condition is basically to check whether a number is a even number or not.

212
00:10:17,000 --> 00:10:17,000
Right.

213
00:10:17,000 --> 00:10:21,000
So if I just go ahead and execute it, how many times this will get displayed.

214
00:10:21,000 --> 00:10:23,000
See zero is getting displayed over here.

215
00:10:23,000 --> 00:10:23,000
Right.

216
00:10:23,000 --> 00:10:25,000
And it is continuously getting displayed.

217
00:10:25,000 --> 00:10:26,000
I'll stop this.

218
00:10:26,000 --> 00:10:28,000
See because I have not written any condition over here.

219
00:10:28,000 --> 00:10:29,000
So let me just go ahead and write.

220
00:10:29,000 --> 00:10:32,000
Count is equal to count plus one okay.

221
00:10:32,000 --> 00:10:34,000
Now how many times it will get displayed.

222
00:10:34,000 --> 00:10:36,000
You just see this okay.

223
00:10:36,000 --> 00:10:37,000
Only one time.

224
00:10:37,000 --> 00:10:39,000
Because the next time it became one, this count became one.

225
00:10:39,000 --> 00:10:41,000
The one percentile two is not equal to zero.

226
00:10:41,000 --> 00:10:45,000
So it is just going to come outside of the, uh, loop right of this particular loop.

227
00:10:45,000 --> 00:10:48,000
This is just to show you an example over here.

228
00:10:48,000 --> 00:10:50,000
But we will be seeing with more amazing examples.

229
00:10:50,000 --> 00:10:55,000
First of all, let's go ahead and just see the basic syntax of for while.

230
00:10:55,000 --> 00:10:59,000
And now we are going to go ahead with respect to loop control statements okay.

231
00:11:00,000 --> 00:11:02,000
Loop control statements.

232
00:11:03,000 --> 00:11:05,000
You'll be seeing that, uh.

233
00:11:05,000 --> 00:11:07,000
Uh, please give more examples.

234
00:11:07,000 --> 00:11:07,000
Don't worry.

235
00:11:07,000 --> 00:11:12,000
After I probably make you understand all these things, then we will be seeing more examples as we go

236
00:11:12,000 --> 00:11:12,000
ahead.

237
00:11:12,000 --> 00:11:12,000
Okay.

238
00:11:12,000 --> 00:11:17,000
Now, uh, with respect to the loop control statement, first of all, we'll discuss about something

239
00:11:17,000 --> 00:11:18,000
called as break.

240
00:11:18,000 --> 00:11:18,000
Okay.

241
00:11:18,000 --> 00:11:23,000
Now, if you really want to understand break, I'll just go ahead and write this definition.

242
00:11:23,000 --> 00:11:29,000
The break statement exist exits the loop.

243
00:11:30,000 --> 00:11:31,000
Permanent.

244
00:11:33,000 --> 00:11:36,000
Uh, exits the loop prematurely.

245
00:11:36,000 --> 00:11:36,000
Okay.

246
00:11:36,000 --> 00:11:38,000
What does this basically mean?

247
00:11:38,000 --> 00:11:39,000
I will just make you understand.

248
00:11:39,000 --> 00:11:43,000
Okay, let's say I want to write a break statement.

249
00:11:43,000 --> 00:11:45,000
Now, how do I write a break statement?

250
00:11:46,000 --> 00:11:50,000
So first of all, let's say I am going to run for I in range.

251
00:11:50,000 --> 00:11:51,000
Okay.

252
00:11:51,000 --> 00:11:54,000
Please make sure that you understand the syntax for I in range.

253
00:11:54,000 --> 00:11:56,000
Range of the collection.

254
00:11:56,000 --> 00:11:57,000
This is nothing, but this is collection.

255
00:11:57,000 --> 00:11:58,000
It can be a list.

256
00:11:58,000 --> 00:11:59,000
It can be a dictionary.

257
00:11:59,000 --> 00:12:00,000
It can be range.

258
00:12:00,000 --> 00:12:00,000
It can be string.

259
00:12:00,000 --> 00:12:01,000
Anything.

260
00:12:01,000 --> 00:12:01,000
It can be.

261
00:12:01,000 --> 00:12:03,000
And let's say I'm writing ten.

262
00:12:03,000 --> 00:12:06,000
So ten basically means it is going to iterate from 0 to 1.

263
00:12:06,000 --> 00:12:06,000
Okay.

264
00:12:07,000 --> 00:12:12,000
For one of the condition I'll say if I is double equal to five okay.

265
00:12:12,000 --> 00:12:19,000
If this I is equal to five, I don't want to probably or I want to come outside this particular loop

266
00:12:19,000 --> 00:12:19,000
okay.

267
00:12:19,000 --> 00:12:22,000
I want to come outside this entire for loop.

268
00:12:22,000 --> 00:12:24,000
So I will go ahead and just write break okay.

269
00:12:25,000 --> 00:12:27,000
And once we probably write break okay.

270
00:12:27,000 --> 00:12:32,000
It is probably going to come outside of this particular for loop itself right now.

271
00:12:32,000 --> 00:12:33,000
One more thing.

272
00:12:33,000 --> 00:12:36,000
If I is not equal to five at that time, we just need to print I.

273
00:12:36,000 --> 00:12:36,000
Okay.

274
00:12:36,000 --> 00:12:41,000
So now see what is this entire code that I have actually written for I in range of ten.

275
00:12:41,000 --> 00:12:46,000
If I is double equal to five, I am saying only when I is equal to five do.

276
00:12:46,000 --> 00:12:49,000
The break statement comes outside of this particular for loop.

277
00:12:49,000 --> 00:12:52,000
When I is not equal to five, you just need to keep on printing the numbers.

278
00:12:52,000 --> 00:12:57,000
Okay, so now if I go ahead and execute it here, you'll be able to see 012345.

279
00:12:57,000 --> 00:13:02,000
Then when five came automatically we came outside of this particular for loop Okay.

280
00:13:02,000 --> 00:13:05,000
And then after that nothing is getting printed.

281
00:13:05,000 --> 00:13:09,000
So we are exiting this particular loop permanently.

282
00:13:09,000 --> 00:13:10,000
Okay.

283
00:13:10,000 --> 00:13:12,000
Permanently with the help of break uh, over here.

284
00:13:13,000 --> 00:13:18,000
But this break will only get applied on any statement on any condition as such.

285
00:13:18,000 --> 00:13:18,000
Right.

286
00:13:18,000 --> 00:13:22,000
So that is why we are specifically using this break statement.

287
00:13:22,000 --> 00:13:22,000
Okay.

288
00:13:23,000 --> 00:13:25,000
Uh, this is one of the good examples.

289
00:13:25,000 --> 00:13:30,000
Uh, again, uh, now, with respect to the another loop control statement, we also have something

290
00:13:30,000 --> 00:13:31,000
called as continue.

291
00:13:32,000 --> 00:13:32,000
Okay.

292
00:13:32,000 --> 00:13:35,000
So now we will go ahead and write continue.

293
00:13:35,000 --> 00:13:37,000
Now what exactly continue is okay.

294
00:13:37,000 --> 00:13:43,000
And you also need to know this if I really want to define continue okay.

295
00:13:43,000 --> 00:13:48,000
Continue statement skips the current iteration and continues with the next okay.

296
00:13:48,000 --> 00:13:52,000
So that basically means let's say I'm going to write for I in range okay.

297
00:13:52,000 --> 00:13:55,000
For I in range for I in range.

298
00:13:55,000 --> 00:13:58,000
And let's say I write some elements over here.

299
00:13:58,000 --> 00:13:59,000
Ten okay.

300
00:13:59,000 --> 00:14:06,000
And now if I go ahead and write if I modulus two write is double equal to zero okay.

301
00:14:06,000 --> 00:14:10,000
And this condition is basically just to check whether the number is even or not.

302
00:14:10,000 --> 00:14:15,000
If the number is even, let's say that I will go ahead and write continue okay.

303
00:14:15,000 --> 00:14:17,000
I will just go ahead and write continue.

304
00:14:17,000 --> 00:14:22,000
And then I will just go over here print I.

305
00:14:22,000 --> 00:14:22,000
Okay.

306
00:14:23,000 --> 00:14:28,000
Now, in short, if I really want to make you understand, this is just like displaying all the odd

307
00:14:28,000 --> 00:14:31,000
numbers between 0 to 10, right?

308
00:14:31,000 --> 00:14:33,000
Do you agree with me or not?

309
00:14:33,000 --> 00:14:35,000
See what I'm doing over here for I in range of ten.

310
00:14:35,000 --> 00:14:40,000
If I percent, I if I modulus two is equal to zero, that basically means this is an even number.

311
00:14:40,000 --> 00:14:41,000
We are just going to continue.

312
00:14:41,000 --> 00:14:44,000
Otherwise, if it is not, which is an odd number, we are just going to print it.

313
00:14:44,000 --> 00:14:50,000
So if I go ahead and execute this, you'll be able to see that I will only get an odd number 13579 between

314
00:14:50,000 --> 00:14:51,000
0 to 10.

315
00:14:51,000 --> 00:14:51,000
Right.

316
00:14:51,000 --> 00:14:54,000
And that is what is a continue example.

317
00:14:54,000 --> 00:14:55,000
With respect to computing.

318
00:14:55,000 --> 00:14:57,000
We are just we are just skipping the current iteration.

319
00:14:57,000 --> 00:15:00,000
This will just skip it will even not go to the print statement.

320
00:15:00,000 --> 00:15:02,000
It will just go ahead and continue the loop.

321
00:15:02,000 --> 00:15:03,000
Right.

322
00:15:03,000 --> 00:15:06,000
So this is what is the power with respect to the continue statement.

323
00:15:06,000 --> 00:15:12,000
There is also one more amazing flow control that we use that is basically called as pass okay.

324
00:15:12,000 --> 00:15:17,000
And you should know all these things because some or the other way we will be using all these things.

325
00:15:17,000 --> 00:15:17,000
Right.

326
00:15:17,000 --> 00:15:23,000
Uh, further when we'll be seeing multiple example, the pass statement is a null operation and it does

327
00:15:23,000 --> 00:15:24,000
nothing okay.

328
00:15:24,000 --> 00:15:25,000
It does nothing.

329
00:15:25,000 --> 00:15:27,000
Nothing means nothing, right?

330
00:15:27,000 --> 00:15:31,000
It will just say, hey, I don't want to do anything on a specific condition.

331
00:15:31,000 --> 00:15:31,000
Okay?

332
00:15:31,000 --> 00:15:41,000
So now if we go ahead and write for I in range for I in range of five, let's say okay for I in range

333
00:15:41,000 --> 00:15:41,000
of five.

334
00:15:41,000 --> 00:15:44,000
Let's say I'm giving this particular condition okay.

335
00:15:44,000 --> 00:15:52,000
I'm saying hey if I is equal to three, if I is double equal to three okay.

336
00:15:52,000 --> 00:15:54,000
then I'm saying, hey, just pass.

337
00:15:55,000 --> 00:15:55,000
Okay.

338
00:15:55,000 --> 00:15:56,000
Do nothing.

339
00:15:56,000 --> 00:15:56,000
Okay?

340
00:15:56,000 --> 00:15:59,000
I don't want you to do anything over here.

341
00:15:59,000 --> 00:15:59,000
Okay?

342
00:15:59,000 --> 00:16:03,000
And then we are going to print I.

343
00:16:03,000 --> 00:16:03,000
Okay.

344
00:16:03,000 --> 00:16:06,000
Now see what will happen in this particular case.

345
00:16:06,000 --> 00:16:10,000
Whenever I say hey whenever the number is even just skip this for loop.

346
00:16:10,000 --> 00:16:12,000
But here it is saying do nothing.

347
00:16:12,000 --> 00:16:13,000
Just go ahead.

348
00:16:13,000 --> 00:16:13,000
Right.

349
00:16:13,000 --> 00:16:16,000
Just go ahead and skip it right now.

350
00:16:16,000 --> 00:16:18,000
If I go ahead and execute it now, see what is happening.

351
00:16:18,000 --> 00:16:22,000
Zero is getting displayed, one is getting displayed, two is getting displayed.

352
00:16:22,000 --> 00:16:23,000
When I is three.

353
00:16:24,000 --> 00:16:25,000
Again I'm just saying hey, skip it.

354
00:16:25,000 --> 00:16:27,000
So it has just skipped this if loop right.

355
00:16:27,000 --> 00:16:37,000
Or the best way will be to print something like this okay the number is okay I will write number is

356
00:16:38,000 --> 00:16:39,000
over here as I.

357
00:16:39,000 --> 00:16:39,000
Okay.

358
00:16:39,000 --> 00:16:41,000
Now you'll be able to understand this.

359
00:16:41,000 --> 00:16:42,000
Now this pass.

360
00:16:42,000 --> 00:16:43,000
As soon as we do the pass.

361
00:16:43,000 --> 00:16:46,000
Right at that time, what will happen now?

362
00:16:46,000 --> 00:16:49,000
First of all, see, when I is equal to three, it only this will get printed.

363
00:16:49,000 --> 00:16:50,000
And we are just going to skip this okay.

364
00:16:50,000 --> 00:16:52,000
And do nothing as such.

365
00:16:52,000 --> 00:16:54,000
So here you can see 0123.

366
00:16:54,000 --> 00:16:56,000
The number is 334.

367
00:16:56,000 --> 00:16:56,000
Right.

368
00:16:56,000 --> 00:16:58,000
Pass in.

369
00:16:58,000 --> 00:16:59,000
It's just like a null statement.

370
00:16:59,000 --> 00:17:01,000
Suppose I don't have anything to give over here.

371
00:17:01,000 --> 00:17:05,000
I will just remove this and I will just write pass do nothing as such Okay.

372
00:17:05,000 --> 00:17:08,000
So this can also be useful.

373
00:17:08,000 --> 00:17:09,000
And again we'll talk about it.

374
00:17:09,000 --> 00:17:12,000
What exactly will be the use case over here.

375
00:17:12,000 --> 00:17:13,000
Right.

376
00:17:13,000 --> 00:17:19,000
But most of them if I probably consider pass continue or let's say if I'm probably defining an empty

377
00:17:19,000 --> 00:17:20,000
function.

378
00:17:20,000 --> 00:17:25,000
And if I define an empty function and if I internally write, uh, write just pass.

379
00:17:25,000 --> 00:17:27,000
That basically means that the function does nothing.

380
00:17:27,000 --> 00:17:28,000
Okay.

381
00:17:28,000 --> 00:17:32,000
So this is uh, some of the amazing things that have been brought by Python.

382
00:17:32,000 --> 00:17:36,000
Uh, if I talk about break, this will be very handy because on a certain condition we are just going

383
00:17:36,000 --> 00:17:38,000
to break this or come out of this particular loop.

384
00:17:38,000 --> 00:17:39,000
We can use break.

385
00:17:39,000 --> 00:17:41,000
Then we have continue.

386
00:17:41,000 --> 00:17:42,000
Then we have pass.

387
00:17:42,000 --> 00:17:47,000
Right now let's talk about nested loops okay.

388
00:17:47,000 --> 00:17:50,000
So let's talk about nested loops.

389
00:17:51,000 --> 00:17:57,000
Nested loop is nothing but a loop inside a loop, right?

390
00:17:58,000 --> 00:18:05,000
Let's say I will run a loop for I in range three.

391
00:18:05,000 --> 00:18:06,000
Okay.

392
00:18:06,000 --> 00:18:10,000
And let's say for j in range two okay.

393
00:18:10,000 --> 00:18:16,000
Now what I'm doing and let's say I go ahead and print print.

394
00:18:16,000 --> 00:18:21,000
And here uh with respect to the print statement, let me show you how you can use f string also.

395
00:18:21,000 --> 00:18:27,000
So f uh, f string is nothing but here, uh, I'm basically writing it out and here I'll write I is

396
00:18:27,000 --> 00:18:34,000
equal to will will be equal to I and j is equal to it will be equal to j.

397
00:18:34,000 --> 00:18:35,000
Okay.

398
00:18:35,000 --> 00:18:41,000
So whenever we use this f string formatted statement to display the variables we have to use this curly

399
00:18:41,000 --> 00:18:41,000
braces.

400
00:18:41,000 --> 00:18:46,000
And uh, in short, this is just a formatting option of displaying the string.

401
00:18:46,000 --> 00:18:52,000
I can use this particular string together along with, uh, you know, floor braces so that I can display

402
00:18:52,000 --> 00:18:53,000
that particular variable.

403
00:18:53,000 --> 00:18:55,000
Now, what is exactly happening over here?

404
00:18:56,000 --> 00:18:57,000
See, it is very simple.

405
00:18:57,000 --> 00:19:02,000
Uh, over here, you'll be able to see for I in range of three.

406
00:19:02,000 --> 00:19:02,000
Right.

407
00:19:02,000 --> 00:19:05,000
I'm iterating through another range over here.

408
00:19:05,000 --> 00:19:05,000
Another.

409
00:19:05,000 --> 00:19:06,000
Uh iterables.

410
00:19:06,000 --> 00:19:10,000
Over here, Then I'm also running another iteration over here.

411
00:19:10,000 --> 00:19:10,000
Right.

412
00:19:10,000 --> 00:19:12,000
So there are three elements over here.

413
00:19:12,000 --> 00:19:13,000
So first it will run this.

414
00:19:13,000 --> 00:19:15,000
Then it will go inside this.

415
00:19:15,000 --> 00:19:20,000
And it will complete the inner loop right inner inner loop in our in our for loop.

416
00:19:20,000 --> 00:19:21,000
Then it will go to the outside for loop.

417
00:19:21,000 --> 00:19:25,000
So first time when it gets displayed this is going to get executed for the two times.

418
00:19:25,000 --> 00:19:29,000
Then it will going to go and increment the I to two.

419
00:19:29,000 --> 00:19:34,000
Then again it is going to uh run it for two times for this particular loop.

420
00:19:34,000 --> 00:19:35,000
If you don't know.

421
00:19:35,000 --> 00:19:39,000
If you don't understand, see over here, I'll show you with respect to the output.

422
00:19:39,000 --> 00:19:42,000
So here initially you can see when I is zero J is zero.

423
00:19:42,000 --> 00:19:45,000
Because initially when we are running this particular loop.

424
00:19:45,000 --> 00:19:46,000
Right.

425
00:19:46,000 --> 00:19:49,000
And then when we go inside this particular loop J will run for two times.

426
00:19:49,000 --> 00:19:51,000
So j is running for j is equal to zero, j is equal to one.

427
00:19:51,000 --> 00:19:53,000
Then you have I is equal to one.

428
00:19:53,000 --> 00:19:55,000
Then again j is equal to zero, j is equal to one.

429
00:19:55,000 --> 00:19:56,000
Then you have.

430
00:19:56,000 --> 00:19:59,000
When I is incremented to two, j is equal to zero and j is equal to one.

431
00:19:59,000 --> 00:20:02,000
So it is basically going to run with respect to all the inner loops.

432
00:20:02,000 --> 00:20:03,000
Right.

433
00:20:03,000 --> 00:20:07,000
And here this for loop, every time it will be executed based on the number of range that I've actually

434
00:20:07,000 --> 00:20:08,000
given over here.

435
00:20:08,000 --> 00:20:09,000
Right.

436
00:20:09,000 --> 00:20:13,000
Whenever we insert enter the upper for loop itself.

437
00:20:13,000 --> 00:20:13,000
Right.

438
00:20:13,000 --> 00:20:17,000
So this is just an example of uh for loops over here.

439
00:20:17,000 --> 00:20:18,000
Uh, sorry.

440
00:20:18,000 --> 00:20:20,000
Nested loops over here right now.

441
00:20:20,000 --> 00:20:23,000
Let us go ahead and see some examples.

442
00:20:23,000 --> 00:20:23,000
Okay.

443
00:20:23,000 --> 00:20:26,000
And this is where we will practice multiple things.

444
00:20:26,000 --> 00:20:32,000
Uh, the first examples that uh, we are going to do is that, uh, let's say I am going to write over

445
00:20:32,000 --> 00:20:46,000
here, calculate the sum of first n natural numbers using a while loop, using a while and for loop.

446
00:20:46,000 --> 00:20:51,000
Okay, so let me just go ahead and first of all show you with the help of a while loop.

447
00:20:51,000 --> 00:20:51,000
Okay.

448
00:20:51,000 --> 00:20:54,000
So first, uh, we'll see with respect to the while loop.

449
00:20:54,000 --> 00:20:57,000
And then we will go ahead and see with respect to the for loop.

450
00:20:57,000 --> 00:20:58,000
Okay.

451
00:20:58,000 --> 00:21:02,000
What we need to do calculate the sum of first n natural numbers.

452
00:21:02,000 --> 00:21:02,000
Okay.

453
00:21:02,000 --> 00:21:03,000
First n natural numbers.

454
00:21:03,000 --> 00:21:04,000
Very simple.

455
00:21:04,000 --> 00:21:11,000
So now I will just go ahead and say let's uh, say that the number of uh n number, the natural number

456
00:21:11,000 --> 00:21:11,000
is ten.

457
00:21:11,000 --> 00:21:15,000
Then initially I will define my some variable to zero.

458
00:21:15,000 --> 00:21:20,000
This will be my temporary variable because the addition that I'm going to do with respect to all the

459
00:21:20,000 --> 00:21:23,000
natural numbers, I'm going to save it in this particular variable called as sum.

460
00:21:24,000 --> 00:21:28,000
Then I will keep this temporary variable called as count is equal to one.

461
00:21:28,000 --> 00:21:29,000
Okay.

462
00:21:29,000 --> 00:21:31,000
Now let's go ahead okay.

463
00:21:31,000 --> 00:21:39,000
So here I'm going to write while okay count is less than or equal to n right.

464
00:21:39,000 --> 00:21:45,000
Unless until the count is less than or equal to n I'm going to just go ahead and I'm going to use this

465
00:21:45,000 --> 00:21:48,000
sum is equal to sum plus count.

466
00:21:48,000 --> 00:21:49,000
Right.

467
00:21:49,000 --> 00:21:52,000
So what we are doing over here we keep on adding the count right.

468
00:21:52,000 --> 00:21:55,000
Unless and until this is not equal to less than or equal to n.

469
00:21:55,000 --> 00:21:57,000
And after this we will go ahead and write.

470
00:21:57,000 --> 00:22:00,000
Count is equal to count plus one.

471
00:22:00,000 --> 00:22:02,000
We are incrementing the count variable also.

472
00:22:02,000 --> 00:22:10,000
And finally, when this for loop is a while loop is getting completed, I will write some off first

473
00:22:11,000 --> 00:22:14,000
ten natural numbers.

474
00:22:15,000 --> 00:22:21,000
Okay, natural numbers will be equal to nothing, but whatever sum we are probably getting over here,

475
00:22:21,000 --> 00:22:22,000
Right.

476
00:22:22,000 --> 00:22:23,000
Just go through the statements here.

477
00:22:23,000 --> 00:22:27,000
We have initialized how many number of natural numbers we are going to consider.

478
00:22:27,000 --> 00:22:29,000
Initially, the sum is equal to zero, count is equal to one.

479
00:22:29,000 --> 00:22:35,000
Now I'm saying while count is less than or equal to n, I'm going to increment this count continuously

480
00:22:35,000 --> 00:22:40,000
unless and until this gets satisfied then automatically internally we are doing the sum also.

481
00:22:40,000 --> 00:22:41,000
Okay.

482
00:22:41,000 --> 00:22:44,000
So here you can actually see the sum of first n ten.

483
00:22:44,000 --> 00:22:47,000
Natural number is nothing but 55 perfect.

484
00:22:47,000 --> 00:22:53,000
So this is just like one plus two plus three plus four plus five plus six plus seven plus eight plus

485
00:22:53,000 --> 00:22:54,000
nine plus ten.

486
00:22:54,000 --> 00:22:55,000
Right.

487
00:22:55,000 --> 00:22:56,000
Uh, it will not go.

488
00:22:56,000 --> 00:22:56,000
Uh.

489
00:22:56,000 --> 00:22:59,000
Yeah, it will go till ten because we have written less than or equal to n.

490
00:22:59,000 --> 00:23:00,000
Okay.

491
00:23:00,000 --> 00:23:01,000
Perfect.

492
00:23:01,000 --> 00:23:03,000
So this was one of the example.

493
00:23:03,000 --> 00:23:05,000
Uh, let's do it the same thing with the help of for loop.

494
00:23:05,000 --> 00:23:06,000
So I will write.

495
00:23:06,000 --> 00:23:10,000
Uh, so let me just go ahead and define this three variables again.

496
00:23:11,000 --> 00:23:12,000
Okay.

497
00:23:12,000 --> 00:23:17,000
So let's say for I in range.

498
00:23:17,000 --> 00:23:24,000
And here also I can just go ahead and write till 11 because I want to probably do from zero to 0 to

499
00:23:24,000 --> 00:23:24,000
10.

500
00:23:24,000 --> 00:23:25,000
Okay.

501
00:23:25,000 --> 00:23:29,000
And here I'll just go ahead and write sum is equal to sum plus I.

502
00:23:29,000 --> 00:23:30,000
That's it.

503
00:23:30,000 --> 00:23:31,000
Right.

504
00:23:31,000 --> 00:23:33,000
And here I don't even have to write.

505
00:23:33,000 --> 00:23:35,000
This count is equal to one okay.

506
00:23:35,000 --> 00:23:39,000
Because automatically this will get integrated in uh uh incremented.

507
00:23:39,000 --> 00:23:42,000
So here let me just go ahead and print the sum.

508
00:23:42,000 --> 00:23:46,000
And if I go ahead and execute I'm also able to get it 55 okay.

509
00:23:46,000 --> 00:23:53,000
So here I've shown you with the help of both while and for loop how you can calculate the first ten

510
00:23:53,000 --> 00:23:56,000
natural uh numbers sum.

511
00:23:56,000 --> 00:23:57,000
And here you are able to see it.

512
00:23:57,000 --> 00:23:58,000
Okay.

513
00:23:58,000 --> 00:23:59,000
Now, let me do one thing.

514
00:23:59,000 --> 00:24:02,000
Let me show you one more example.

515
00:24:02,000 --> 00:24:02,000
Okay.

516
00:24:02,000 --> 00:24:05,000
Now this time the examples will be.

517
00:24:07,000 --> 00:24:09,000
Talk about the prime numbers.

518
00:24:09,000 --> 00:24:12,000
Or display the prime numbers between 1 and 100.

519
00:24:12,000 --> 00:24:14,000
Now what is prime number?

520
00:24:14,000 --> 00:24:18,000
Prime number are something which is divisible by one or the number itself.

521
00:24:18,000 --> 00:24:19,000
Right now.

522
00:24:19,000 --> 00:24:22,000
Uh, here I'll just go ahead and write it down.

523
00:24:22,000 --> 00:24:24,000
And again for this I will use a for loop.

524
00:24:24,000 --> 00:24:29,000
So I'll write for num in range of one comma 101.

525
00:24:29,000 --> 00:24:29,000
Right.

526
00:24:29,000 --> 00:24:32,000
Because we need the numbers between 1 and 100.

527
00:24:32,000 --> 00:24:33,000
Right.

528
00:24:33,000 --> 00:24:38,000
If uh the first condition will be that I will go ahead and write if num is greater than one.

529
00:24:38,000 --> 00:24:38,000
Right.

530
00:24:38,000 --> 00:24:41,000
Obviously the number has to be greater than one.

531
00:24:41,000 --> 00:24:42,000
So one condition is over here.

532
00:24:42,000 --> 00:24:45,000
We're going to use if nested if nested for loops.

533
00:24:45,000 --> 00:24:45,000
And.

534
00:24:45,000 --> 00:24:50,000
All right please pause the video, try it by yourself and then probably see the solution.

535
00:24:50,000 --> 00:24:51,000
Okay.

536
00:24:51,000 --> 00:24:58,000
Now if this is true then what I'll do for I in range two comma num okay.

537
00:24:58,000 --> 00:25:02,000
Uh, for I in range two comma num.

538
00:25:02,000 --> 00:25:07,000
That basically means from this number from two to this particular number, whichever number we are specifically

539
00:25:07,000 --> 00:25:14,000
discussing or uh from this for loop which number I'm able to increment, I will just go ahead and write

540
00:25:14,000 --> 00:25:15,000
this particular condition.

541
00:25:15,000 --> 00:25:19,000
If num percentile I right.

542
00:25:19,000 --> 00:25:21,000
I is the same number over there.

543
00:25:21,000 --> 00:25:23,000
Right is equal to zero.

544
00:25:23,000 --> 00:25:26,000
Then we are just going to break it okay.

545
00:25:26,000 --> 00:25:31,000
And then we are just going to break and come outside this for loop.

546
00:25:31,000 --> 00:25:35,000
And I'm going to say else print number okay.

547
00:25:35,000 --> 00:25:35,000
Okay.

548
00:25:36,000 --> 00:25:40,000
We just need to print this because if this gets satisfied right.

549
00:25:40,000 --> 00:25:44,000
This is basically indicating that, hey I've got a prime number.

550
00:25:44,000 --> 00:25:44,000
Right.

551
00:25:44,000 --> 00:25:46,000
And then it is just going to display the prime number.

552
00:25:46,000 --> 00:25:49,000
So again I'm repeating first of all I'm going to check a condition.

553
00:25:49,000 --> 00:25:55,000
If number is greater than one then we are going to write for I in range of two comma num okay two comma

554
00:25:55,000 --> 00:25:55,000
num.

555
00:25:55,000 --> 00:26:00,000
So we are incrementing the uh so so we are running through this particular two comma num whatever num

556
00:26:00,000 --> 00:26:00,000
is there.

557
00:26:00,000 --> 00:26:03,000
Let's say the num is uh three.

558
00:26:03,000 --> 00:26:05,000
So two comma three for range in two comma three.

559
00:26:05,000 --> 00:26:09,000
Then we can go ahead and write three percentile two is double equal to zero.

560
00:26:09,000 --> 00:26:11,000
The answer is no right.

561
00:26:11,000 --> 00:26:14,000
If it is no we are just going to go ahead and display this number.

562
00:26:14,000 --> 00:26:14,000
Right.

563
00:26:14,000 --> 00:26:19,000
And if it breaks it is just going to go outside this particular for loop okay.

564
00:26:19,000 --> 00:26:23,000
So that basically means if this condition is becoming true right.

565
00:26:23,000 --> 00:26:26,000
That basically means it is not a prime number.

566
00:26:26,000 --> 00:26:29,000
Otherwise we are just going to display the number in the else block.

567
00:26:29,000 --> 00:26:30,000
Okay.

568
00:26:30,000 --> 00:26:35,000
And one more thing about for loop is that along with the for loop also you can write else block right

569
00:26:35,000 --> 00:26:41,000
else block if something uh you don't want to execute it, but you want to execute compulsory at the

570
00:26:41,000 --> 00:26:42,000
end of the for loop.

571
00:26:42,000 --> 00:26:45,000
So you can also use this else block okay.

572
00:26:45,000 --> 00:26:47,000
So once I execute this here you'll be able to see two three.

573
00:26:47,000 --> 00:26:50,000
So two is a prime number three is a prime number five.

574
00:26:50,000 --> 00:26:54,000
Seven is a prime number 1113, 17, 19, 23, 29.

575
00:26:54,000 --> 00:26:55,000
All these are prime numbers.

576
00:26:55,000 --> 00:26:57,000
You can probably go ahead and check it out okay.

577
00:26:58,000 --> 00:27:02,000
Uh these are like numbers which are only divisible by one or the number itself.

578
00:27:02,000 --> 00:27:02,000
Right.

579
00:27:02,000 --> 00:27:04,000
So here you can actually see the example.

580
00:27:04,000 --> 00:27:04,000
Okay.

581
00:27:05,000 --> 00:27:13,000
Now some more uh, uh examples that you will be seeing as we go ahead where we'll be using when we learn

582
00:27:13,000 --> 00:27:17,000
more about, uh, different, different data structures like lists and dictionary.

583
00:27:17,000 --> 00:27:22,000
But at the end, uh, conclusion that I really want to give after every lesson.

584
00:27:22,000 --> 00:27:22,000
Right.

585
00:27:22,000 --> 00:27:25,000
And let me make a markdown cell over here.

586
00:27:25,000 --> 00:27:26,000
Okay.

587
00:27:27,000 --> 00:27:30,000
So conclusion is that loops are really powerful.

588
00:27:31,000 --> 00:27:31,000
Okay.

589
00:27:31,000 --> 00:27:35,000
Loops are definitely very, very powerful okay.

590
00:27:36,000 --> 00:27:41,000
Um, in Python that allows you to execute block of code multiple times by understanding, using for

591
00:27:41,000 --> 00:27:44,000
and while loops along with the loop control statement like break, continue, and pass.

592
00:27:44,000 --> 00:27:49,000
You can handle a wide range of programming tasks efficiently, and you'll be seeing that when we will

593
00:27:49,000 --> 00:27:51,000
be discussing about more examples.

594
00:27:51,000 --> 00:27:56,000
But I really want to keep the video between 20 to 25 minutes, where I show you multiple examples where

595
00:27:56,000 --> 00:27:59,000
I write each line of code in front of you so that you'll also be able to understand.

596
00:27:59,000 --> 00:28:01,000
So yes, this was it from my side.

597
00:28:01,000 --> 00:28:02,000
I'll see you all in the next video.

598
00:28:02,000 --> 00:28:02,000
Thank you.

