Concatenating Strings in Python
In Python concatenating two string is essay and fun,let’s see with the help of a practical example
So in this way you can easily concatenate strings in python
One more fact is that while declaring a string we may use ” ” or ‘ ‘ both means the same,however using both of these in the same line will be more fun try it yourself and then ask if any query will be there
String as a Combination of Characters
String is a combination of characters this means that every single character in the string should be treated individually also and python offers us that too
let’s try it out
Now this shows us that if we store LETUSLEARN in a string every of it’s individual string can be treated as individual character, now the question arise is that if you want to call the character at 4 or 7 or any other location, how can we call it?
The answer is to simple let’s show you with an example.
In this example we can see that we can call individual character’s of the strings,and if we are giving the index number which exceed the numbers of character it’s showing us an error “string index out of range“
Now it was really awesome,but now if we want characters between index numbers,is that possible too??
let’s have a look at that too by an practical exapmle:
In this way we can have characters between the index numbers also.
Let’s go one step forward and see one more amazing fact
here we have specified staring part and in another example only the ending part in another example,and we have gotten the full string till them,that can be seen easily.and in one more example we have given in which we have given index out of bound. And that’s to working perfectly.
This figure shows you the example of getting the length of the string,go try more practice more and get more amazing stuffs like this.