We are going to discuss Biton strings, the string is nothing but sequence of characters, and these
characters can be of Lorqess, alphabet's, uppercase alphabets, digits and some special characters.
A string is a sequence of characters and string can contain alphabet's digits and special characters.
Computers do not deal with the characters computer convert them into numbers.
That is a binary number system.
That means each and every character will be represented in the form of zeros and ones.
Even though we may see characters on our screen internally, it is being stored and manipulated as a
combination of zeros and ones in the binary representation.
This conversion of character to a number is called encoding, and the reverse process is known as decoding.
So encoding means from character to the binary.
The presentation and decoding means from the binary presentation to the character generation.
So ASCII and Unicode are the sum of the very popular encoding techniques we use.
So for this better idea on the python strings.
So let us go for practical demonstration right now in Python string means sequence of characters.
So let us define that.
What are the different ways to define a string in Python?
So there is no one that is here.
This will come has been enclosed within a single course.
So if we go on printing, this might instead one I'm getting this will come here.
Here will come is enclosed within double codes here will come is enclosed within tripled single course.
So in this way we are getting this welcome God printed.
Now here we are having this triple cinequest triple double rather also can use as a single code.
So that is not an issue.
So print Maistre three, it will go on printing.
That is welcome to the world of Python programming.
So triple codes, a string can extent multiple lines.
So in place of this single double code, if we can put a single triple code here, then what we the
outcome are going to get any change in the outcome in the case.
So let me go for execution on finding that I'm getting the same output as I got earlier.
So accessing characters in the string.
So here my state is equal to language.
And then I printed this my estimate here.
So language has got printed and then I'm retrieving the character at the Zero Index, so I shall tip
this.
L So l has got print it now minus one.
That means from the last from the back where this, this particular E is having the index minus one
and from the front this E will have the index that is zero.
One, two, three, four, five, six, seven.
So if we, if we print there seven, if we just I'm just printing here the once again.
So you can find that so in the bookcases, in the bookcases I shall be getting, this has got printed
at seven or minus one.
So minus one means that there is a starting character index from the from the back, from the tail of
the string.
So next one is one to five.
That means index number one, two, three and four because five will be almost exclusively the stopping
index number will be almost exclusive.
So one, two, five mins, one, two, three, four.
So here we are mentioning this this one and why they were separated by this column.
So that is my zero so zero I'm not going to take.
So there is a character at the present index one.
So one, two, three, four.
So I've taken this eight and G.U. and you see we are getting this output like this.
So now here I am having this four minus two sorry, five minus two.
So there is a five year.
So I'm going to take this one as zero one, two, three, four, five.
So that means we're having this one as five here.
So now we are having this one as minus two.
So that is minus one.
Minus two, you know, that will be will be taking this stopping index as exclusive.
So I'll be remaining with this only.
So it has got printed.
So that means Hypercolor minus two means from the character and to the minus three characters.
So minus three means this is my minus one, these are minus two and minus three.
So that's, that's why it has got printed.
So but if I make this one sport, if I make this minus four, then obviously we're getting the output
like this.
So that is you eight in that case.
Now here you see this 10.
The index is not present here because this language is having we are having, say, eight characters.
So index will be ranging from zero to seven.
So then index is not a valid one.
So if I want to access the 10th character, so character at the 10th index, so we are getting this
index error, so string index out of French.
So that is the error message you are getting here.
OK, now we're going for this.
So here we have defined this language.
So strings are immutable.
That means they cannot be changed, but the different strings can be assigned to the string object.
So if we bring this mindstate, I'm getting this language.
But if we if we want to update it, I want to put another new string to this milestone in the same biddable
that is allowed by default to update the third character of the string that is not allowed as it is
immutable.
So there is a time period and it's their object does not support item, item assignment, so that is
that there is an error message we are getting and in the error name is type error.
Next one, we're going for the concatenation of the string and that can be done using plus so dear one
and my two containing welcome and one blank space and then two on.
So now when they are going for the concatenation I'm getting the outcome.
This one.
So welcome to all this blank space is essential because otherwise this will come and two will not have
any separation.
So they will get concatenated.
Side-By-Side.
So now here you are having this, that is my Mystere start three.
So what will happen to my Asgeir start three.
So this particular my dear, will be orcharding for my usted one will be orcharding for three times.
So welcome, welcome, welcome.
So in this way we are going to get the request from the string so we can do the string on concatenation,
either using star or using the plus operators.
Now we're going to discuss or plot and start what I have discussed.
No iterating through our string here.
So later, count is digital.
So four letters in haloed if the letter is is going to is equal to L.
So now letter count is equal to one.
So what will happen?
So I will go on counting the number of occurrences of this character.
So that's why each and every time the volume for Loop will pick up one character at a time and that
will be put in the letters.
So if letters is integral to the letter, count will be increased by one.
And after exiting from the indentation, you are getting this idea that this print is outside of the
for loop.
So letter count will be printed accordingly.
So if you go on executing, I'm getting that three times.
Each letter has been found here.
Now we are going for the string membership.
So L in hello.
So Alien Hello will return true lotting.
Hello will return false B in hello will return false.
B not in hello.
Will return still here.
Built in functions, built in function, so we're having this university and then we shall go for the
enumerate, so least enumerate Mystere.
So what will happen?
It'll go on forming this enumeration.
So at first it'll put the respective respective index.
And then we're having the respective character here.
So in this way, we're having this index zero.
You index one end in this way or having this index nine y because universities having 10 characters.
So index will be ranging from zero to nine.
And in this way you are getting it.
So here you see we are forming a list, we are forming a list because we are just converting it to a
list.
And then the members are nothing but that tuples that members are nothing but a tuples because they
have got separated by commas and they have got enclose within Fastback.
And so they are the simple, simple tuples on list of couples who are getting hit.
A list of Mystere will be then accordingly.
And here we have used a method that is the enumerate.
Now, we shall deal with this single quote, end quote.
So what we shall do that?
Let us suppose I'm going to print this one.
So when I'm going to bring this one, it is producing one error, right, error, because this is a
double code, this is one double code.
So it'll take this double header dominating as a dominating double gold.
So that's why it is causing error here.
And also this what is it?
It is telling that invalid syntax because the codes are not matching.
So quotes are not balanced.
So to right the statement here to write the string getting printed on the output, we can go for this.
So what we are doing, we're enclosing it within single quotes and this particular string is still within
double.
So now you see we're getting Dropcam like this.
Others, we can include the mainstream within single codes and putting this one as the double code can
here.
This particular single code is there and we are going for the escape character.
So there is a single code and which will be known as escape goats that escape single codes.
So whenever we are going to print, it will print their respective only this single code here.
So now we are having this skipping single code.
So now in closing, we're doing the reverse.
Actually, here we have put this single code as an outer one and double code.
That is the inner one.
But if you go for the double cross as the outer one and single course as the inner one, then obviously
this single course will get printed here.
Otherwise we can go for this.
That means we can skipping double codes.
That means we're going for this slash double code.
So here, this double code will be treated as a cat character, not the beginning of the of the ending
of a string.
So that's why we are going for the escaping double also.
So when the string will get printed.
So slash double code will be printed as only a single a double code and slash double code will be printed
as only a single as a single double code.
And here we are having this single code is there.
So that will not cause any problem.
So in this way, the string can be printed in various of ways.
So either using triple quotes or using escaping the single codes, escape into single codes once again
and then escaping the double codes once again.
Next, we are going for this, so here you see this is a print, I want to make it printed.
So whenever we are having double slash, it will print as single slash.
Here you can find we are printing this one as a single slash.
But actually, industry, we're having the double slash, so this is having a new line, there is a
slash and so what will happen?
It'll go to the next line without having to slash.
There is a gap.
So there is a separate is there for eight characters.
And then we can also write in this way, that is slash X 41.
So 41 will be treated as in hexadecimal.
So what is the decimal value against four to one?
So forward into six to the one that is 64 plus one in two six zero.
That is one.
So 64 plus one.
That is 65.
Which character is having this asking for six to five.
That is of a capital eight.
So it is similarly we are having this capital B, similarly we are having this capital C, so this ABC
will be there.
So in this way, you can also print the respective string.
What having this format so different order is equal to.
So now we here to see these other different placeholders, we're having DOT format.
So today will be coming to this is going to be coming to this and Sunday will be coming to this placeholder.
So here we are having this default order.
If we go on printing, I'm getting the output like this one.
So today is and Sunday, so we are getting this, today is and Sunday, so today is coming to this is
is coming today.
So they are maintaining the order.
There is a default implicit order.
And here you are using this format method.
So already using positional argument.
So here this is my argument.
No argument, No.
One.
Argument number two.
So the positional arguments, the numbering will be something like this.
So he had mentioned in the argument, but no here.
So that is up.
So one means today will be coming down.
So zero minutes is will be coming down here and sun will be coming down to this particular placeholder
during the hour.
So you can find that today is and Sunday so ordered using keyword argument.
So here you can mention this one I as is to is d as is equal to today and this is equal to Sun.
So here you are mentioning the respective keyword arguments there.
So there is DS and we are getting the output count output like this one.
So that is another way to print our string.
Formatting numbers.
So here to see where having this format 20 20 is only one argument is there?
So it is argument position number is zero.
So we are printing here and here, printing zero, but in the binary format.
So whatever the outcome in the case, so 20 will be printed along with this 20 in the binary form,
that is 16 plus four and that is our 20.
So now we are having this formatting float's.
We can go for this formatting.
So now we are having the zero that wins.
This particular number is going to get printed and that will be printed in this EXPONENTIATION format.
And now we are having this one by three and we're going to bring this one, this argument number, Giteau
and then Kolon.
That is that decimal point 3F.
So after the decimal point will be going to have about three decimal digits.
But having this particular strings and having the string method, there is a lot apart find and we are
having the plus Soyinka's look at all the string characters will be converted to the lowercase in case
of apart, all the string characters will be converted to the uppercase irrespective of the initial
case here.
So find two.
So these two will be found at the 13th index.
So let me go on counting here.
So that is about one, two, three, four, five, six, seven, eight, nine, 10, 11, 12.
And from the 13 index, these two is beginning.
So that's why I'm getting here 13.
But if you go on searching this to all this DNA in the lowercase, we may not get a match because it
is a sensitive find.
So as a result of that, it will give me the outcome as a minus one means unsuccessful searching.
So replace all by everybody and it plus all by everybody know heresy there that if you consider the
case insensitivities, if you are getting a match, so all will be replaced by everybody.
But here it is.
All is written all in lowercase, so hll so everybody cannot replace it.
So because that is not a no match has been observed using this replace method.
So in this way we have discussed that how to operate the string and what are the different string methods
and operations can be carried out in this session.
Thanks for watching this video.