Coming to the joint string method that we have used over here in the written statement.
Now, this basically is help to or do a joint of individual column strings into the 054 takes us into
one string.
So the joint method is basically called on a string value and takes a list of strings.
It returns one string that has all the members in the list, joined by the string that join method is
called on.
For example, if you want to try it in the interactive shell, let's go back to Titan here and here.
Recreate, say, for example, L1.
That's equal to.
Let's give some different text there.
And here we see a single dot dot joint.
Eleven, so we have added that value there, a black value to it, similarly, if we see the joint LVA,
so we get a comma for every value that we have there, or if we see capital ABC DOT join LVA, we get
ABC added to every value in the particular string.
So when you call the joint on an empty string and join the list that is Elvan, you get the list of
list strings concatenated with no string in between.
So in some cases you might want to separate each member in the list to make it more readable, which
we have done when we say join on calling the string in a comma, that's insert a string comma between
each member of the list.
You can also insert any string you want between the list members, as we have done in the last.
OK, now coming to the return values and the written statement.
So let's go back to our goal here and only function or the function call always evaluates to a particular
value.
So this is the value written by the function of the method.
So also called the return value of the function of when you create your own function using the def statement,
a written statement, this python Waterton value for the function is like over here we have total return
in single code dot joint and this ciphertext Istria.
So here we call joint on the blank string and passes ciphertext as the argument.
So the string in the ciphertext SDR list are joining the single string coming to a written statement
example.
Now a written statement is basically a written word, followed by the value to be written so you can
use an expression instead of a value like when you do.
So, the return value is whatever that expression evaluates.
True.
For example, let us create a new file and we would say here a definition for add numbers, say a comma
C, and here we are going to see written A plus C and we would say here, print in bracket C, add numbers.
We give your say three comma 50 as the parameter.
Let's see if this as normal 12 thought by and let us execute this so we get the values.
Fifty three when the program is executed.
Now that is because the function calls or add numbers because the three and four feet as the value and
evaluates to fifty three and the written statement in the function that we have created.
Add the second line, evaluates the expression A plus C and returns the evaluated value to the calling
program.
Right.
Similarly, we have the returning of the encrypted text in our demo.
So like in this case over here, we are returning the value back when we are actually calling the particular
program.
So in this, the encrypt messages still function, returns the statement that returns a string value
that is created by joining all of these strings in the ciphertext list.
And this final string, the result of the encryption code is retained by our encrypt messages to our
function.
Now, a great advantage of using functions is that a programmer has to know what the function does,
but doesn't need to know how the function scorebook.
A programmer can understand that when they call a particular function and pass it an integer as well
as a string for the key and the message parameters function call evaluates to an encrypted string.
They don't need to know anything about how the code is encrypted, actually, which is similar to know
that you pass a particular string to the print message in the particular given string back to the function
for now coming to the underscore variable like we have used here in the IF.
But now you can don the given transposition encryption program into a module using a special trick involving
the main function and the variable named the underscore name.
Now when you run a Python program, that's to underscore before they went to one of the schools after
name that we have used here is assigned the string mean even before the first line of the program runs
the double and the score is often referred to as the under in Python and double the score mean double.
And the school is called the under the under.
At the end of the script you want to have some code that checks whether the name variable has mean string
assigned to it.
If so, you want to call the main function the if statement over here that we have used the second last
line.
Actually is one of the first line of the code which is executed when you run the particular program.
So when you run this basically first check if name is equal to mean and it'll call the main function.
The reason the machine is set up over here this way is that although Python is said name to mean when
the program is run, it sets it to the string transposition of the file the mountain over here, if
the program is imported by another program or another python program, we can see similarly to how the
program imposes a paperclip module to call the function in it.
So other programs might want to import the same program to call it encrypt messages still function without
the main function running.
So when an import statement is executed, Python looks for particular modules file by adding a dot prior
to the end of the file.
So this is how our program knows whether it's being run as a main program or importer by a different
program as a module.
So if you import a Python program and before the program is executed, the name variable is set to define
the import before dot be right.
For example, here it is.
The more tentative program is imported and all the def statements are run.
But the main function is the call.
So the encryption code for that we have that python hacking code message with the key of it will not
be executed.
So that is why the code that encrypts the my message is to string with the mixture is inside a particular
function and this code inside mean we won't run.
Your actual name would then not be via program, which is imported by another program.
But these other programs can still call the encrypt messages still function.
That is how they functions.
School can be reused by other bitin programming.
That is right.
So in this way, we have seen our whole demonstration actually doing it manually also, and then doing
the same goal in the Python program also, which has made up a concept of how actually the transposition
cipher looks very much clear.
Right.
So that's it from the session.
Thank you very much.