00:01
Okay, in this question we want to write pseudocode to find a number of capital letters in the text.
00:08
So remember, pseudo code is code that we're going to write by hand that could easily be translated in any computer language or most computer language, but it's not actually written in any specific language.
00:23
So we are going to have c, which is going to be all the characters, the characters in the text file.
00:49
In the text file.
00:51
So depending on the programming language you use, this could be a string or an array of character.
00:58
I'm going to go with string because it's the most common.
01:02
And i write it in blue because not all programming language require you to specifically type your variable.
01:10
Then we're going to be to have a another variable big n, which is going to be the number of characters in the file.
01:31
So basically n is the size of r string c and this is going to be an integer variable.
01:41
And finally we're going to have another counter which is going to be called number of capital o, number of number of number of capital letter which is going to start at zero.
02:02
This is also going to be an integer.
02:06
Now we're going to iterate over all the characters that we have in our stream.
02:11
So for i equal zero to i equal n minus one, you could also write for i equals one to i equals one to i equal n but most programming language tend to start from zero.
02:37
I'm going to stick with this notation here but you could translate it and simply have this if you prefer but for now i'm going to erase it and stick with what's most tender.
02:49
So that means we're going to go through every character in the text file.
02:55
So if c so a conditional statement a control flow statement if if what were if are the first character or the second like the character i is a letter so let's say we have two method here is a letter so maybe it's a character but it could be a punctuation sign or a number but for now but what we want is a letter and and c .i.
03:47
Is capital.
03:55
Then what are going to do? we're simply going to have number of capital letters plus equal 1.
04:13
And that's pretty much all we have to do here.
04:18
We have to check if the character is a letter and if it's capital.
04:23
So rather easy we go through every character is it a letter is it capital yes then we increment a number of capital letters from our counter if it's not we simply continue so the number i'm going to write here i'm gonna write answers about my pseudocode so the number of comparison so for every character we may we have two checks.
05:06
We check is it a letter and is it capital? so we have two n comparison because we have n characters and for every characters we check two things.
05:25
And if you want, maybe your method is capital.
05:32
You could already check if it's a letter...