Now, after this import the next few lines in our program, we are basically having the MWD string variable,
we are having the key variable, which is having the value given us 30.
And we also have the more type which is encrypted.
And I decided to encrypt decrypt.
Now here, the MSD string, it basically stores the string that is to be encrypted or decrypted.
And the key variable that is our key stores, the end of the encryption key.
Right.
So the more type variable over here stored the string encrypt decrypt, which makes either the code
later in the program that is encrypting a string or decrypting a string.
Now coming to the constants and the variables that are used in this program.
Now, constants basically are variables whose values shouldn't be changed when the program runs.
Now, for example, in the CS ASIFA program, we need a string that contains every possible character
that can be encrypted with this program now because that string shouldn't be changed.
We store it in a constant named symbol's type.
Right now, one more thing over here.
We will make similar type like this and let's copy it everywhere that we have used the particular variable.
Now we will show you what is the use of this, but let's see if this and run I get.
OK, fine.
So now over here you can see the variable that we have taken is basically just a common item, which
is used in a cryptography for a single character that is a cipher to encrypt decrypt.
Now, a symbol basically is a set which is every possible symbol for the set up to encrypt, because
we will be using the symbol said many times in this particular program and because we don't want to
tie the full string value each time it appears in the program, we are using your constant to store
the values.
Why have we changed to all uppercase?
Because whenever we use any variable name all in uppercase, it means that we are using it as a constant.
So the value once assigned will not be changed.
It is just like any other variable that all uppercase name reminds the program.
What I do not write the code that does so, as with all the conventions, if you don't have to follow
this one.
But doing so makes it easier for other programs to understand how these variables are basically used.
Right.
Then we take a blank string variable that is translated as Steyr, which is just having a blank volume
and do it, which will be storing the translated value in the given variable.
Now for it currently we are giving it the blank value itself.
Now we come to our formal statement over here.
Now we are using this for SVM in our message Oremus G String.
We recall that Ovie loop the loop as long as a certain condition is true and also the for loop has a
slightly different purpose and doesn't have a condition like the loop.
Instead it loops over a string or a group of values.
So for every value in M is destroying, the volume will go on executing itself.
And each time the program execution goes through the loop that is on each iteration to the loop.
The variable in the fourth statement takes on the value of the next character in the variable containing
a particular string.
In this case at this is just not for the fourth statement is similar to an assignment statement because
variable is creative.
Assign the value except the false statement cycles to different values to assign the variable.
Now let us see a simple example of for loop.
We'll just go to the interactive shell over here and we will type the particular form of things before.
Letter, see?
Happy here we are seeing Brent, in fact, the letter is plus the value of letter.
OK, so here we get each an individual value of the particular character getting printed at the end
of the line.
So this particular group gets all the gold loops over each character in the string happy.
And when it does, the variable little takes on each of the characters in the string.
Happy one at a time in order so we can just rewrite the code in the loop that brings the value of liquor
for each iteration.
Now, again, similarly, we understand of how I look at providing fuel or fodder for the formula is
very similar to Vilo.
But when you only need to iterate over characters in a string, using a for loop is more efficient and
you could make a loop at like a four Liuba writing a bit more code like this, for example, I go to
zero, we save while I is less than the length of C happy column.
You open the envelope here.
Here we use letter that's equal to say happy.
At the index, I will use your brain in single quotes, the letter is plus the value of letter and we
say, I will stop I plus one.
So here again, we get the same values printed over here using the value.
So notice that this file looks the same as we had before, but is not as short and simple as the photo
of the month, which we have written about.
First, we need to set a variable that is to zero before the final statement.
Then the statement will have a condition that will evaluate to true.
As long as the variable is then the length of the string happy because it is an integer and only keeps
track of the current position in the string.
We will need to declare a separate letter variable to hold the character in the string at the position,
and then we can print the current value of the letter to get the same output as the formula.
So when the code is finished executing, we need to increment also the eye by adding one to to move
it to the next position.
So it is better for us to use the for loop in case of, hey, look over here, because we will make
it a more shorter and smarter look on loop, which we can write down in no particular program.
Now we move on to our next part in the program that is coming to the F condition.
Here we are using if Asli in our simbel right now, you can read an if statement as so if this condition
is true, execute the code in the following block.
Otherwise, if it is false, skip the block.
And if statement is formatted using the key, if followed by the condition followed by a colon, the
code to execute is in the neck in the block, just as with the loops.
So for example, we will try an if statement and see how does it basically look.
C will go back here and we will see print C and.
Your.
But whether you made a mistake, your friend and
your password.
OK, but now we basically need to write down in a separate file as we need to execute this together.
So what we will do is let's go for a new file and we would write down, say, print and of your password.
Then we will create here, say password input is equal to use the input method, store whatever password
the user have type over here.
Check if the.
Password input.
Is equal to a particular possible settlement, one to three, for example, if it is, then you say
access granted and use your friend.
See that?
OK, so now we save this.
Let us save it again in e drive hacking big enough and we save it over here by the name Cicek Password,
not Fibi.
And we try to execute this.
So enter password.
Now we enter a capital we had given that a small so it does not giving us the access.
Granted it is just Google giving us the value done.
But suppose we go back here we again run the module, the internal admin.
One, two, three.
It says access granted and then the statement is done.
So then you run the particular program with displays your full that that is enter your password and
lets the user type the password over there.
Whatever password is then typed by the user is stored in the variable that we have created.
That is our password input.
Right next.
The if statement checks the password is equal to the string that is admin, all in small case, one,
two, three.
If it is the execution rules inside the block following the if statement of the text as X is granted.
Otherwise, if the password input isn't equal to admin one, two, three, even if the case is all that
is a capital admin or something like that, the execution skips the if statement block either way and
the execution continues on to the court after the if block or display, just the statement that's done
right now.
Similarly, we will see what happens if we use the statement over here, OK?