Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,390 --> 00:00:01,780
What is going on, guys?
2
00:00:01,800 --> 00:00:08,230
And in this video, I actually actually I think this video should be split up into two parts, OK?
3
00:00:08,790 --> 00:00:11,490
The first part should be in this video.
4
00:00:11,490 --> 00:00:14,520
In the second part should be in the next video.
5
00:00:16,260 --> 00:00:20,920
So basically, what should these exercises be all about?
6
00:00:21,480 --> 00:00:28,590
So we are going to write a simple function that is called to lower, OK, so functioning is going to
7
00:00:28,590 --> 00:00:33,450
be to lower and these function.
8
00:00:33,480 --> 00:00:39,140
All it has to do is just, first of all, to receive a character.
9
00:00:39,360 --> 00:00:41,370
So you know how these can be done.
10
00:00:41,400 --> 00:00:41,850
Right.
11
00:00:41,880 --> 00:00:45,150
And what function can receive a character in.
12
00:00:45,160 --> 00:00:52,080
Once you do receive a character, you have to check if this character you just received.
13
00:00:52,290 --> 00:01:01,890
OK, this character is a capital letter in English, OK, capital letter in uppercase, let's say if
14
00:01:01,890 --> 00:01:14,270
it's in uppercase uppercase letter, which means all of the letters from A, B and so on out to Capital
15
00:01:14,280 --> 00:01:14,760
Z.
16
00:01:14,910 --> 00:01:15,270
Right.
17
00:01:16,320 --> 00:01:25,830
If that's the case, then the function, what it has to do is to return the lowercase, the lowercase
18
00:01:26,070 --> 00:01:30,420
representation of this letter, the lowercase letter.
19
00:01:30,930 --> 00:01:32,700
OK, so in this case it should return.
20
00:01:32,700 --> 00:01:38,340
Either it's a if it was in upper case, A either is B, either it's C and so on.
21
00:01:38,490 --> 00:01:38,770
OK.
22
00:01:38,790 --> 00:01:44,070
So basically you got the idea right.
23
00:01:44,890 --> 00:01:46,410
That awesome.
24
00:01:48,390 --> 00:01:50,580
OK, so that's what do you have to do.
25
00:01:50,580 --> 00:01:56,940
And if the character is not an upper case, meaning that the result of this condition is false, then
26
00:01:56,940 --> 00:02:03,720
the function should simply return, let's say otherwise return.
27
00:02:04,960 --> 00:02:05,710
Minus one.
28
00:02:06,250 --> 00:02:13,000
OK, so that's basically our function for now, I hope that's clear, simply a function called to lower
29
00:02:13,150 --> 00:02:15,030
receives a character checks.
30
00:02:15,040 --> 00:02:21,520
If this character is an uppercase letter, if that's the case, we return the lowercase representation
31
00:02:21,520 --> 00:02:22,180
of this letter.
32
00:02:22,360 --> 00:02:29,540
Otherwise, if the character was not in uppercase, then we will simply return minus one.
33
00:02:29,560 --> 00:02:31,780
So that's our function for today.
34
00:02:32,980 --> 00:02:34,370
OK, so let's start.
35
00:02:35,680 --> 00:02:41,280
And first of all, what we have to think about is what will be the type of this function?
36
00:02:41,950 --> 00:02:44,600
So we know that we have to return the character.
37
00:02:44,630 --> 00:02:50,080
So probably chances are high that we need to return it of type char.
38
00:02:50,560 --> 00:02:58,720
So Char and let's call this function to lower as we were requested, that unspecified char and let's
39
00:02:58,720 --> 00:03:00,760
call this letter.
40
00:03:01,240 --> 00:03:07,060
OK, and now the body of the function should be something like that.
41
00:03:07,810 --> 00:03:16,360
We have to somehow to be able to distinguish if a letter is a capital letter, is an uppercase letter
42
00:03:16,360 --> 00:03:16,650
or.
43
00:03:17,920 --> 00:03:28,930
So we know that if we have taken a look at the ASCII table, then all of the letters which are from
44
00:03:28,930 --> 00:03:38,440
A to Z, OK, from capital A. to to Capital Z, from uppercase to uppercase, that they are all kind
45
00:03:38,440 --> 00:03:44,000
of in a sequence or there all comes after one another.
46
00:03:44,020 --> 00:03:56,590
So if we will ask if a letter is greater or equal to a two to upper Casey and also if this letter is
47
00:03:56,590 --> 00:03:59,500
less than or equal to Capital Z.
48
00:03:59,830 --> 00:04:00,250
OK.
49
00:04:00,280 --> 00:04:06,730
So if that's the case, meaning it can be all the letter from A B up to Z.
50
00:04:06,790 --> 00:04:08,600
OK, this is the range.
51
00:04:08,770 --> 00:04:09,640
It can be.
52
00:04:10,360 --> 00:04:15,610
Then in this case, we should return this letter.
53
00:04:15,670 --> 00:04:19,630
OK, in the lowercase representation.
54
00:04:19,630 --> 00:04:21,730
So meaningless right down here.
55
00:04:21,820 --> 00:04:22,780
One example.
56
00:04:23,380 --> 00:04:25,920
So let's go like examples.
57
00:04:26,710 --> 00:04:36,520
And basically if you received a letter like that K then what you should return is just K if you receive
58
00:04:36,520 --> 00:04:47,380
the letter like B then you should return B and if you receive it, I don't know some letter like this
59
00:04:47,590 --> 00:04:52,570
for then you should return simply minus one.
60
00:04:52,930 --> 00:05:01,630
OK, so how basically if you know the representation of the letter itself, if it's an uppercase, how
61
00:05:01,630 --> 00:05:06,300
can you calculate and return the lowercase representation.
62
00:05:08,050 --> 00:05:15,400
And that's something that we have basically to understand about the ASCII table, which we have to do
63
00:05:15,760 --> 00:05:18,340
is just to take the letter.
64
00:05:18,400 --> 00:05:24,300
OK, so what we will do is like to return, OK, return and what should we return?
65
00:05:24,340 --> 00:05:27,060
We should return the letter itself.
66
00:05:27,520 --> 00:05:31,980
It has some numerical representation, right.
67
00:05:31,990 --> 00:05:38,590
Although it's a character and we will reduce the value of an uppercase A..
68
00:05:38,650 --> 00:05:46,750
OK, so this has some numerical representation and also a letter has and basically if you take a letter
69
00:05:46,750 --> 00:05:52,990
and you do minus the the lower the upper case A, you will receive some number either, which will be
70
00:05:52,990 --> 00:05:58,450
one, two or three or four or five, six, I don't know, up until 26, if I'm not mistaken.
71
00:05:59,290 --> 00:06:07,900
And once you do so, you will receive here just some, let's say, integer number and you want to return
72
00:06:07,900 --> 00:06:09,810
the lowercase representation.
73
00:06:09,850 --> 00:06:16,680
So in this case, you will take plus and you will add a lower case, a lowercase eight.
74
00:06:17,290 --> 00:06:19,410
So why is this so useful?
75
00:06:19,900 --> 00:06:23,020
You know, that if you had a letter, let's say I don't know.
76
00:06:23,020 --> 00:06:23,490
See.
77
00:06:23,700 --> 00:06:30,850
OK, so if the letter was capital C and you took the letter and you reduced A from it, so you received
78
00:06:30,850 --> 00:06:32,950
basically two probably.
79
00:06:32,950 --> 00:06:33,270
Right.
80
00:06:33,280 --> 00:06:40,800
You'd say, yeah, it's it will be too, like the the numerical representation of C minus the American
81
00:06:40,930 --> 00:06:49,000
representation of A which is behind the scenes simply simply C equals two if I'm not mistaken.
82
00:06:49,000 --> 00:06:53,290
Forty three and a capital eight is forty one.
83
00:06:53,290 --> 00:06:53,710
Right.
84
00:06:54,130 --> 00:06:58,150
Forty one capital A's were presented as forty one.
85
00:06:58,150 --> 00:07:00,400
Then you will have here two OK.
86
00:07:00,820 --> 00:07:04,420
And then you will take two and you added to the lower.
87
00:07:04,480 --> 00:07:14,590
Case eight, which in this case, I'm sorry, sir, it's not 43, it's 65 and capital and it's 67 and
88
00:07:14,590 --> 00:07:18,460
capital, a little upper case, a sixty five.
89
00:07:18,460 --> 00:07:20,920
Then in this case, also, it still will be two.
90
00:07:21,100 --> 00:07:24,520
OK, so let's have a minus.
91
00:07:24,820 --> 00:07:29,440
Uppercase is two plus A and A is ninety seven.
92
00:07:29,440 --> 00:07:35,710
Then you will receive 99, which is the decimal representation of a lower case.
93
00:07:35,710 --> 00:07:39,600
C OK guys, so you see what we are doing here.
94
00:07:39,790 --> 00:07:40,960
Is that clear to you.
95
00:07:42,490 --> 00:07:52,180
So that's basically how you take these kind of formula, how you take OK and you simply calculate from,
96
00:07:52,810 --> 00:07:59,860
from the uppercase character representation to the lower case representation.
97
00:08:00,040 --> 00:08:00,500
OK.
98
00:08:01,390 --> 00:08:04,890
And of course the Eltis return to minus one.
99
00:08:06,340 --> 00:08:14,350
So I know that's not the most trivial exercise, but that's the basis and the basic representation and
100
00:08:14,350 --> 00:08:16,300
usage of the ASCII table.
101
00:08:16,720 --> 00:08:20,050
So please, guys, let me know if you still have any questions.
102
00:08:21,010 --> 00:08:22,200
Feel free to ask it.
103
00:08:22,210 --> 00:08:25,360
Maybe I will try to clarify it even further.
104
00:08:25,840 --> 00:08:30,610
And yeah, don't worry, it's not so complicated in the next video.
105
00:08:30,640 --> 00:08:33,840
We are going also to practice this even further.
106
00:08:34,030 --> 00:08:36,510
So thank you so much for watching and I'll see you then.
9907
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.