Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,210 --> 00:00:01,380
Whoo hoo!
2
00:00:01,410 --> 00:00:10,410
So we are back and in this exercise, what we have to do is to like to get some seconds into to calculate
3
00:00:10,680 --> 00:00:17,910
and to preen the following result, just like these clock hours, minutes and finally the remaining
4
00:00:17,910 --> 00:00:18,590
seconds.
5
00:00:19,140 --> 00:00:27,240
So we've seen one example on their presentation and we said that that basically we will simply receive
6
00:00:27,420 --> 00:00:28,210
seconds.
7
00:00:28,230 --> 00:00:33,110
So in seconds and then we are going to read these seconds from the users.
8
00:00:33,110 --> 00:00:36,270
So intersections, right.
9
00:00:37,090 --> 00:00:39,480
Then releasing information and store it inside.
10
00:00:39,480 --> 00:00:40,980
Variable seconds.
11
00:00:42,780 --> 00:00:43,590
Seconds.
12
00:00:44,190 --> 00:00:45,780
Yay!
13
00:00:45,990 --> 00:00:48,250
OK, so, yeah, that's good.
14
00:00:49,110 --> 00:00:52,770
And now what we have to do is simply to do the following.
15
00:00:52,800 --> 00:00:54,550
So what is it?
16
00:00:54,780 --> 00:01:03,580
What do we have to do now is like let's do it, let's, let's do it, let's do it like this.
17
00:01:04,050 --> 00:01:11,610
So what we need to understand is, first of all, let's decompose kind of decompose the seconds into,
18
00:01:12,300 --> 00:01:20,940
let's say, hours, minutes and remaining seconds, which is pretty much just what we've used previously
19
00:01:20,940 --> 00:01:25,110
in our previous examples in the previous section, I guess.
20
00:01:25,500 --> 00:01:28,970
So in this case, let's use our minutes, remaining seconds.
21
00:01:29,550 --> 00:01:32,870
So erm let's calculate them.
22
00:01:32,880 --> 00:01:34,970
You remember how to calculate the hours.
23
00:01:35,310 --> 00:01:37,850
You simply take the total seconds.
24
00:01:37,860 --> 00:01:42,830
Let's just call it once again total ten seconds.
25
00:01:43,590 --> 00:01:50,830
So you take the total seconds and you divide it by you divide it by thirty six hundredth.
26
00:01:50,880 --> 00:01:57,630
Since we know that there is thirty six hundred seconds in a given hour and it will give us the total
27
00:01:57,630 --> 00:02:02,090
amount of hours that we have in this representation to fool hours.
28
00:02:02,700 --> 00:02:03,630
And all right.
29
00:02:03,630 --> 00:02:09,810
Afterwards you can calculate the minutes to remember the full explanation to why we counted using the
30
00:02:09,810 --> 00:02:12,900
total seconds, minus hours multiplied by three.
31
00:02:12,900 --> 00:02:14,610
Sixteen three.
32
00:02:14,610 --> 00:02:15,990
Sixty three.
33
00:02:16,560 --> 00:02:17,670
Thirty six hundred.
34
00:02:17,680 --> 00:02:18,500
Sorry for that.
35
00:02:18,900 --> 00:02:20,700
That's a little bit tired now.
36
00:02:22,020 --> 00:02:28,050
OK, I'm just recording a lot of exercise during the day and it's already evening.
37
00:02:28,350 --> 00:02:29,540
So sorry for that.
38
00:02:30,090 --> 00:02:36,060
So total seconds minus hours multiplied by thirty six hundred and this will give us the remaining,
39
00:02:36,840 --> 00:02:40,050
the remaining seconds that are left.
40
00:02:40,090 --> 00:02:47,310
OK, so total seconds minus the seconds that were taken into consideration by using these hours variable
41
00:02:47,580 --> 00:02:54,530
and all of that divided by 60 because we know there are 60 seconds in a given minute.
42
00:02:55,380 --> 00:02:56,140
All right.
43
00:02:56,160 --> 00:03:01,140
So finally, all that remains for us to do is to calculate the total seconds.
44
00:03:01,140 --> 00:03:12,240
So remaining remaining seconds equals to the total seconds, minus hours multiplied by three six three
45
00:03:12,480 --> 00:03:15,390
thirty six hundred and all of that.
46
00:03:15,390 --> 00:03:22,170
We know that that's the seconds remaining and we know that we can calculate the remainder simply by
47
00:03:22,170 --> 00:03:27,680
using remainder of six sixty and it will give us the total remaining seconds.
48
00:03:27,690 --> 00:03:33,780
OK, so the main logic behind it, I'm simply not going to get into all the details right now because
49
00:03:33,780 --> 00:03:37,400
we talked about it in the previous exercise, in the previous section.
50
00:03:37,800 --> 00:03:39,440
So I think, yeah, that's OK.
51
00:03:39,870 --> 00:03:45,960
And now all that remains to do is not simply to use the following line that what that wouldn't work,
52
00:03:45,970 --> 00:03:46,240
OK?
53
00:03:46,260 --> 00:03:50,070
So percentage D percentage and percentage there.
54
00:03:50,490 --> 00:03:57,930
Now let's use fewer hours minus the minutes and remaining seconds.
55
00:03:58,450 --> 00:04:01,540
OK, so let's try to build and run it and see what will happen.
56
00:04:02,340 --> 00:04:05,400
So go here, build and run.
57
00:04:05,430 --> 00:04:06,570
What is the problem.
58
00:04:06,900 --> 00:04:09,950
Can F doesn't work here.
59
00:04:10,980 --> 00:04:11,700
What is the problem.
60
00:04:11,730 --> 00:04:12,680
What kind of percentage.
61
00:04:12,690 --> 00:04:14,640
The seconds.
62
00:04:14,650 --> 00:04:17,280
So let's see, let's see.
63
00:04:17,280 --> 00:04:18,270
What's the problem.
64
00:04:18,280 --> 00:04:20,100
Seconds is undeclared.
65
00:04:20,100 --> 00:04:22,020
OK, so seconds is undeclared.
66
00:04:22,500 --> 00:04:28,260
No problem at all because we changed the variable name to total seconds so yeah that should be it.
67
00:04:29,010 --> 00:04:30,270
Let's build and run it.
68
00:04:31,460 --> 00:04:39,500
So anthracyclines, let's go with 4000 like we had in the sample, and we will see one 640 and while
69
00:04:39,500 --> 00:04:45,010
that's true, there is one hour, six minutes and 40 seconds in this time.
70
00:04:45,680 --> 00:04:51,990
The problem is that we were requested to print the time in the following format, like our hour, minute,
71
00:04:52,010 --> 00:04:52,990
minute, second, second.
72
00:04:53,000 --> 00:04:59,680
So it should be just the two digits representing the hour and two digits representing the minute.
73
00:05:00,140 --> 00:05:02,960
So that's the main note that I said.
74
00:05:03,260 --> 00:05:08,930
And I told you in the presentation when where I showed you the the exercise itself.
75
00:05:09,410 --> 00:05:12,540
So that's something that we also need to take into account.
76
00:05:12,950 --> 00:05:19,810
So this approach of just printing, you know, like however you like, won't work.
77
00:05:20,120 --> 00:05:27,680
But what we need to understand is that hours, these variable may be of one digit and also it may contain
78
00:05:27,680 --> 00:05:28,670
two digits.
79
00:05:28,670 --> 00:05:33,460
And the same goes for the minutes and also for the seconds.
80
00:05:33,470 --> 00:05:33,890
Right.
81
00:05:34,340 --> 00:05:36,560
So in this case, we need to understand that.
82
00:05:36,890 --> 00:05:45,140
And if we know that hours or minutes or remaining seconds have just either of them has just one digit,
83
00:05:45,530 --> 00:05:50,960
then in this case we should add the the digit of zero beforehand.
84
00:05:50,990 --> 00:05:53,420
So, for example, we had something like this.
85
00:05:53,420 --> 00:05:53,780
Right.
86
00:05:54,080 --> 00:05:55,230
Like inves example.
87
00:05:55,580 --> 00:06:00,800
Then in this case, we will we we see that the hours it has just one digit.
88
00:06:00,810 --> 00:06:04,400
Then in this case, we need to do something like this zero one.
89
00:06:04,530 --> 00:06:12,740
OK, and then we notice that the minutes also has one set, one minute one digit, and we should do
90
00:06:12,740 --> 00:06:13,730
something like this.
91
00:06:14,150 --> 00:06:20,480
Finally, for so that these representation will be will correspond to this one.
92
00:06:21,290 --> 00:06:22,000
All right.
93
00:06:22,010 --> 00:06:25,170
So for that, what do you think should be done?
94
00:06:25,790 --> 00:06:32,240
OK, there are many additional approaches to solve this exercise, but one of the best approaches,
95
00:06:32,240 --> 00:06:39,500
in my opinion, is simply to check if a given condition, if a given condition, if a given variable
96
00:06:39,500 --> 00:06:43,300
is just one digit or two digits, more so on.
97
00:06:43,730 --> 00:06:52,100
So if it if it's just consists of one digit so we can check the following condition if ours is less
98
00:06:52,100 --> 00:06:52,670
than 10.
99
00:06:52,830 --> 00:06:59,900
OK, and if that's the case, if ours is less than 10, then we know for sure that it will probably
100
00:06:59,900 --> 00:07:00,530
be OK.
101
00:07:00,530 --> 00:07:07,910
If we assume that ours is from zero to to 12, it should be right over to 24.
102
00:07:08,180 --> 00:07:15,080
Then we can say that if ours is less than 10, then in this case we will print, OK, we will simply
103
00:07:15,080 --> 00:07:18,360
print zero without a new line, without anything.
104
00:07:18,380 --> 00:07:19,820
So that's what we've done.
105
00:07:19,820 --> 00:07:23,960
We simply printed out here with printed let's go like this.
106
00:07:24,170 --> 00:07:25,640
So we printed zero.
107
00:07:25,900 --> 00:07:28,340
OK, and what should we print next.
108
00:07:28,760 --> 00:07:30,690
OK, what do you think we should print next.
109
00:07:31,040 --> 00:07:38,600
Next we should print print F percentage the OK and column and ours.
110
00:07:39,260 --> 00:07:40,550
So what we've done here.
111
00:07:40,700 --> 00:07:42,750
OK, what do, what do we do here.
112
00:07:43,160 --> 00:07:46,650
So we said let's print zero and then let's print ours.
113
00:07:46,760 --> 00:07:49,350
So in this case it's one and it's looking ok.
114
00:07:49,760 --> 00:07:52,520
OK, I see you see what we're doing here.
115
00:07:53,090 --> 00:07:59,840
So the question is what was what, what should we do if the hours was like, I don't know, 12 or 11,
116
00:07:59,990 --> 00:08:08,600
let's say that's that's the hour, then in this case, we simply would have gotten a false result on
117
00:08:08,600 --> 00:08:13,370
this condition and we simply would not print the zero.
118
00:08:14,210 --> 00:08:19,560
We would just go and print the hours, which in this case will be just 11 minutes.
119
00:08:19,580 --> 00:08:21,920
Also something that we wanted to do.
120
00:08:22,160 --> 00:08:23,880
That's part of the exercise.
121
00:08:23,950 --> 00:08:26,210
OK, so I hope that's clear.
122
00:08:26,240 --> 00:08:31,220
This printing of cigarroa and the same approach, we are going to do four minutes.
123
00:08:31,220 --> 00:08:34,580
So if minutes is less than 10, right.
124
00:08:34,580 --> 00:08:37,770
Because we want to know if it contains just one digit.
125
00:08:38,030 --> 00:08:39,290
So we that's the case.
126
00:08:39,440 --> 00:08:41,120
Let's print once again zero.
127
00:08:41,870 --> 00:08:45,110
OK, so if that's the case, we print zero.
128
00:08:45,110 --> 00:08:50,770
And if the minutes wor I don't know, like 50, then there is no need to print.
129
00:08:51,020 --> 00:08:53,390
There is no need to print zero.
130
00:08:53,390 --> 00:08:55,400
Then we just could have printed 50.
131
00:08:55,850 --> 00:09:05,330
But in this case we also print out percentage, the right percentage and just like this.
132
00:09:05,630 --> 00:09:11,370
OK guys, so we print the minutes right afterwards and call in here.
133
00:09:12,200 --> 00:09:14,830
OK, so we are almost done.
134
00:09:14,840 --> 00:09:20,870
And finally we have to check the remaining seconds as long as it's less than ten.
135
00:09:20,880 --> 00:09:21,950
OK, one digit.
136
00:09:22,250 --> 00:09:24,710
And in this case, also print zero.
137
00:09:25,100 --> 00:09:26,660
And finally print out.
138
00:09:27,740 --> 00:09:29,900
Print F percentage the.
139
00:09:30,670 --> 00:09:39,820
And no, there is no need for that, just a backslash and at the end of it and you know, OK, what
140
00:09:39,820 --> 00:09:40,720
happened here?
141
00:09:41,470 --> 00:09:42,620
OK, awesome.
142
00:09:43,030 --> 00:09:48,620
So, yeah, and here specifically, the remaining seconds and the.
143
00:09:48,620 --> 00:09:51,460
Yeah, I think we are done right.
144
00:09:51,680 --> 00:09:52,990
Let's remove these part.
145
00:09:54,050 --> 00:09:58,960
This part is not necessary for us anymore and also we can remove this part.
146
00:09:59,390 --> 00:10:06,760
So that's the main, let's say, logic behind the solution of this exercise, simply understanding that
147
00:10:06,760 --> 00:10:10,570
we can use conditions as part of the printing operation.
148
00:10:10,990 --> 00:10:12,370
Let's just see what happens.
149
00:10:12,400 --> 00:10:14,560
So anthracyclines four thousand.
150
00:10:14,860 --> 00:10:18,450
Then in these kids you see zero one zero six forty.
151
00:10:18,910 --> 00:10:20,290
So you notice of it.
152
00:10:20,290 --> 00:10:22,930
For example, let's say, I don't know, fifty thousand.
153
00:10:22,930 --> 00:10:24,070
I don't know what it was.
154
00:10:24,340 --> 00:10:25,690
Thirteen, fifty three.
155
00:10:25,690 --> 00:10:26,260
Twenty.
156
00:10:26,480 --> 00:10:34,120
OK, so you see that if any of the variables, hours, minutes or seconds is not less than ten, then
157
00:10:34,120 --> 00:10:41,350
this following line, these following command of printing zero in the corresponding spot will simply
158
00:10:41,350 --> 00:10:42,890
not be executed.
159
00:10:43,600 --> 00:10:46,930
So here I think this is easy for these video guys.
160
00:10:46,930 --> 00:10:48,270
I hope you liked it.
161
00:10:48,970 --> 00:10:55,840
Let me give you some review or some feedback if you want me to continue making these exercises and also
162
00:10:55,840 --> 00:11:00,660
your overview review of these scores so far.
163
00:11:00,940 --> 00:11:04,660
So until next time, keep on practicing and we will meet again.
14693
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.