Strings Manipulation
Strings Manipulation
Strings manipulation
Strings: It is a collection of characters kept in single
quotes, double quotes or triple quotes. It is a immutable
data type.
Example: a= ‘python’ or a= “python” or a= ‘’’ python ‘’’
Indexing: it refers to assigning integers or numbers to
each character of the string to access them.
It is of 2 types:
1. forward indexing: it starts from left to right and
numbers assigned are from 0 to length -1.
Example:
String operations:
1. Concatenation: it joins 2 or more strings together by
using the ‘ + ’ operator. But a number and string can not
be operated by + at the same time.
Example:
Input:
output:
COMPUTER SCIENCE : STRING MANIPULATION
COMPUTER SCIENCE : STRING MANIPULATION