Python String Datatypes

aimtocode

DataType Definition

Data types are means to identify the type of data and associated operations for handling it. In python, we need not to define the type of the variable while declaring it. The interpreter implicitly binds the value with its type accordingly.

Data types represent a kind of value which determines what operations can be performed on that given data.


String DataType

Strings in Python are identified as a contiguous set of characters represented in the quotation marks.

Python allows for either pairs of single(' ') or double quotes(" ").

Subsets of strings can be taken using the slice operator ([ ] and [:] ) with indexes starting at 0 in the beginning of the string and working their way from -1 at the end.

The plus (+) sign is the string concatenation operator and the asterisk (*) is the repetition operator. For example –



This will produce the following result –

 Python Programming
 P
 g
 tho
 thon Programming
 Python ProgrammingPython Programming
 Python Programming Course


Read Also:


aimtocode