Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,480 --> 00:00:02,280
So welcome back, ladies and gentlemen.
2
00:00:02,400 --> 00:00:06,930
I hope you try to solve this exercise on your own to solve this punishment.
3
00:00:06,960 --> 00:00:09,660
And now let's move on to solving it together.
4
00:00:09,750 --> 00:00:14,110
So the first thing that I want to say is a quick reminder of what we want to do.
5
00:00:14,150 --> 00:00:18,630
Want to bring this message of I'm sorry for not listening.
6
00:00:18,630 --> 00:00:20,250
For not listening.
7
00:00:20,720 --> 00:00:29,000
Listen, listening to your teacher or Alphatech, let's say I will practice practice.
8
00:00:29,050 --> 00:00:29,870
What was it like?
9
00:00:29,880 --> 00:00:32,580
I will practice more next time.
10
00:00:32,680 --> 00:00:32,830
OK.
11
00:00:33,150 --> 00:00:36,810
So that's the message that we want to print a thousand times.
12
00:00:37,110 --> 00:00:41,400
And one of the ways to do so is just by using the printf command.
13
00:00:41,520 --> 00:00:42,840
Simply use a printer.
14
00:00:43,240 --> 00:00:43,650
Okay.
15
00:00:43,680 --> 00:00:45,060
And just copy and paste.
16
00:00:45,160 --> 00:00:47,670
Are all of this message to here.
17
00:00:48,120 --> 00:00:50,010
And now let's zoom out.
18
00:00:50,490 --> 00:00:56,170
Now, if we take a look, we just printed out one message, one sorry message for just one time.
19
00:00:56,310 --> 00:01:03,150
And what we can do, what we can do if we didn't practice enough and we were not listening for the feature,
20
00:01:03,150 --> 00:01:06,980
we need to copy and paste this message a thousand times.
21
00:01:06,990 --> 00:01:08,560
So one, two, three.
22
00:01:08,590 --> 00:01:09,820
And there you go.
23
00:01:09,840 --> 00:01:10,890
A thousand times.
24
00:01:11,010 --> 00:01:13,590
So basically, that's kind of tedious, right?
25
00:01:13,830 --> 00:01:20,880
We don't want to use a repetitive prayer or printf command if we know that we can use loops because
26
00:01:20,940 --> 00:01:26,480
we said whenever we will have some task that repeats itself.
27
00:01:26,490 --> 00:01:29,010
And in this case, that's exactly what happens.
28
00:01:29,190 --> 00:01:32,040
Then we definitely should consider using loops.
29
00:01:32,370 --> 00:01:37,750
So to use a loop here, we are probably going to use on what we are going to use.
30
00:01:37,770 --> 00:01:39,530
We are going to use a for a loop, right.
31
00:01:39,540 --> 00:01:44,400
Because we know in advance how many times we will do the same command.
32
00:01:44,560 --> 00:01:48,120
So for that will create an eye variable int I.
33
00:01:48,570 --> 00:01:49,010
OK.
34
00:01:49,110 --> 00:01:52,200
And here we will use about for a loop.
35
00:01:52,230 --> 00:01:58,340
So we're right, four are in the parentheses we specify there on initialization phase.
36
00:01:58,380 --> 00:01:59,700
So I equals two.
37
00:01:59,700 --> 00:02:00,270
One.
38
00:02:00,510 --> 00:02:08,760
And as long as I is lask or equals two with thousand which means we'll run the loop body for a thousand
39
00:02:08,760 --> 00:02:09,340
times.
40
00:02:09,450 --> 00:02:13,530
And basically on every duration we are going to increment I by one.
41
00:02:14,070 --> 00:02:18,190
And with this will be just our body, our preme def command.
42
00:02:18,240 --> 00:02:25,080
So in these curly brackets, I just remind you guys here is going to be our body, our look body.
43
00:02:25,170 --> 00:02:29,770
So on every duration, as long as I is less or equals to a thousand.
44
00:02:29,820 --> 00:02:30,210
Okay.
45
00:02:30,360 --> 00:02:34,350
On every duration we are going to print this message.
46
00:02:35,550 --> 00:02:37,040
So basically that's it.
47
00:02:37,170 --> 00:02:38,910
That's not a complicated exercise.
48
00:02:38,940 --> 00:02:46,140
But but guys, can you notice that with using loops, we can do this in just a couple of lines instead
49
00:02:46,140 --> 00:02:47,610
of copying and pasting.
50
00:02:47,760 --> 00:02:53,100
Are all of these tedious work for a thousand lines and so on and so forth?
51
00:02:53,400 --> 00:03:00,540
We are just using in this case, our new concept, new that we learned in this section, the four loops.
52
00:03:00,930 --> 00:03:02,590
We could also use the wire loop.
53
00:03:02,640 --> 00:03:05,610
But in this case, we decided to use for a loop for a reason.
54
00:03:06,930 --> 00:03:08,500
So basically, that's neat.
55
00:03:08,880 --> 00:03:10,760
I hope you got the idea.
56
00:03:10,860 --> 00:03:18,120
And this punishment is over and your teacher will be definitely glad if he gave you he gave you this
57
00:03:18,120 --> 00:03:18,480
task.
58
00:03:18,570 --> 00:03:19,660
So thank you so much.
59
00:03:19,660 --> 00:03:20,310
We're watching.
60
00:03:20,470 --> 00:03:21,630
And let's move on.
5105
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.