String operations in python !!
String :
String is a series of characters. In Python, we can store a string in a variable and print a variable by it's name.
Output : How are you ?
Here, we store a string in variable a and get output by print variable a.
String Concatenation :
String concatenation means combine two different strings
Here, we can take two different string separately and combine with concatenation.' + ' operator is used to concatenation.
Output : Hello Khush
Here, we joint two strings Hello and Khush.
Here, we joint two strings Hello and Khush.
Array Of String :
String stored in variable as array. Index of array start from 0 and stores like below,
Here, as see above character store in array from 0 to 10.
Output : Hello World
H
e
l
Here, string store in variable in a. when we print a[0] = H, a[1] = e, a[2] = l.
Partition Of String :
Partition of string means divide string into different parts as [start index : end index].
When we want to output as a some part of string then we use partition of string.
Output : He
llo K
o Khush
Here, first we get [0:2] string it means we get 0 and 1 index of array as output.same in [2:7] 2 to 6 index of array is print.and in [4:] the index array from 4 to l end is print.