Now, after this, we move to the out of the particular definition of mean, and here we define another
matter that we have already called inside, that is encrypted message Hestia, which would be taking
Sady here, Steyr and messages still.
And in this message of particular function, we are calling the cipher text Asgeir.
That's equal to the making it blank multiplied by the value of gearstick.
After we have done this, we will loop through the each column in the ciphertext.
So we would see here for columnist here in the range and range we would be giving you this key.
Still, here we are seeing the.
Got an idea.
And here we are making that sequel to the column last year, and once we have done through that after
this, we will keep looping until the current index goes past the message.
So over here, we would run of a loop seeing the current index.
If it is less than the length of your message, dear, if at this, then we will place here the ciphertext
star and the index of columnist here, and then we would see Plus's equal to the messages dear and in
brackets the current IDEX, after which we would move to the current index or the current index.
Seeing the current index plus is equal to the GST.
Now after this, let's convert the ciphertext list into a single string and return it.
So let's come back in the for loop.
And here we would write down the return statement dot join the value of ciphertext hestia and come out
of the definition.
And over here we say if name is equal to mean single quotes, then you're going to call the main method.
So let us save this.
Let's save it in Python hacking beginner and let's give it a name as demo be right and let us try to
run this module.
So this is how we are getting this particular value.
If we just copy down this and the manual thing that we have done, let's go here and let's pasticcio.
Let's see, it is coming in the similar manner that we have done the only thing we are not replacing
that any particular thing, we are getting their spaces instead of the symbols that we have created
here.
Otherwise, the text that we have created manual and the way we have got your manual through the index
in the same way we are getting it through the output when we do it into the python hacking by the transposition
cipher.
Now, let us understand the particular code that we have used to there.
So here the vertical pipelined symbols here basically marks the end of the ciphertext in case there
are spaces at the end of it.
OK, so this ciphertext without the pipe character at the end is also copied to the clipboard.
You can pasted into any of your e-mail if you want.
And if you want to encrypt a different message or use a different key, you will change the value assigned
to.
My messages to G.R. or guests variables.
And you can then again run that particular program.
Now, let's understand the way we have created this.
After importing a paperclip module, we have used up defined statement or death statement to create
a custom function that is mean.
Now, the death statement means you creating or defining a new function that you can call later in the
particular program in a block of code after the def statement is the code that will basically run when
the function is called.
So when you call this function, the execution moves inside the lock of the code following the functions.
Def statement.
So after this we can, for example, suppose we take up the example of a print method or we can take
a string value as an argument between its parameters.
So when you define a function that takes argument, you put a variable name between its parentheses
in its def statement.
So these variables are called the parameters.
So here the main function defines that there are no parameters for main function.
So it takes no argument when it is called.
If you try to call a function with too many or too few arguments for a number of parameters, the function
has Python will give you an error message and that gives succumbing to defining a function that can
take argument with the parameters.
Now we will do some sort of execution of a particular code, will create a function with a parameter
and then call it with an argument.
So let us open here again, a new file and we will define see, for example, hello once we are defining
your name is Estela and we are giving their print simple saying hello, string comma and concatenate
with that name Mystere.
And then we are saying come out of this definition, we call print and here we see start.
After which we go for gallingly one function, your repass, one particular parameter.
Again, we say put in psychology function again and again we call Halo one.
This time we call it with some different parameter and then we say perent printing that.
Now, let us save this as Demo 11. be right and let us execute it.
This is how we get it start.
Hello.
Alice called the function again.
Hello ABC.
And then we get to the values that it's all over here.
Let's go to this particular program now where the halo function over here, the Demo 11 that we have
executed, executes or starts at the top.
The DEF statement defines one function named Halo, one with one parameter, which is the variable name
Mystere.
The execution skips the block after the def because the block is only real.
When the function is called next, it'll execute first print start, which is why START will be printed
when you run the program.
Next line after print is the first function call to help run the program.
Execution jumps to the first line in the Hellerman function block and the string that is we have allies
will be passed as an argument and is assigned to the parameter.
Name is Escherichia and this function call brings the string as hello comma Alice to the screen.
Now when the program execution reaches the bottom of the def statement execution jambox to the line
with the call function and continue executing the call from there.
So now we will get the next print that is called the function again will be printed.
Now the second call to the function Hellerman would be done after that and the program execution again
comes back to hell over this time.
The parameter that we have passed is ABC would be replaced here in the name you your value and it printed
Hello comma ABC again.
When the function returns, the execution goes to the next line, which is the print done.
Now, this is the last line of the program.
So the program exists now.
You can change the parameter, exist only inside the particular function.
Now you'll see another particular example.
You enter it directly into the interactive Chynn now will create a code that will define or define and
then call a particular function named see if you see one.
And in the interactive shell, you will have required to enter that a blank line to close the definition
of the function block.
For example, if you go here and here, you see the fine function, if you can see one.
And here we are defining it with one item we are giving their C bottom is equal to the value of forty
two, ended by placing one more and then we create your span is equal to say hello.
Then we call here if you see one and pass the value span.
And then we say, bring in bucket spane, we get the blueprint, hello, because now that is being replaced,
the spam value is hello, we have that value over there and protect the value back again.
Now, this particular function that we have created takes a parameter that is better and sets its value
to 42.
Now the code outside the function creates a variable span and sets it to a string value and then the
function is called.
And then Spanish sprinter.
Now, when you run the program, print call on the last line will print hello and not 42 because main
function is called Spalatin argument.
Only the value inside the spane is being copied and assigned to the parameter.
Any changes made to the parameter inside the function will not change the value in the actual variable.
So every time a function is called a local school is created.
Variables created during the function call exist in this local school and are called local variables.
But amateur's always exist in a local school, not think of a school as a container.
The variable exists inside.
When the function returns, the local school is destroyed and the local variables that were contained
in the particular school are also forgotten.
Variables created outside every function exist in the global school and our goal as global variables.
So when the program exist, the global scope is destroyed and all the variables in the program are forgotten.
How variable must be local or global?
It cannot be bought for different variables, can have the same name as long as they are in a different
school.
So they would be still considered as two different variables, even if their name is C.
So an important idea to understand is that the argument value that is passed into a function call is
copy to a parameter.
So even if the parameters change, the variable that provided the argument value will never change.