Each of the string characters are stored in a specific index location : see example below
GENERAL
Strings are immutable (they can not be modified)
A string is a sequence of characters used to store text information
A string can be enclosed in single, double or triple quotes (',",''')
To embed a new line in a string use \n : k="Hello World!\nIt's hot"
To continue a line that spans over multiple rows use \ : k="Hello World!\
It's hot"
Triple quoted strings do not use escape sequences (backslash) - line breaks
are preserved as newline characters
FUNCTIONS AND METHODS
String Function: A function is a module of code that is called by name. You can pass data to the
function in the form of arguments, and it can return some value. The data to be passed needs to be
explicit.
String Method: A method is also called by name and may return a
value. Methods are associated with objects.
LISTS
A list is a collection of elements, which might include other lists. Lists begin
and end with square brackets and the elements are separated with
commas. ["Apple","Pear","Orange"]
FINDING THE LENGTH OF A LIST
To find the length of a list you use the
len( ) function, which returns the length
as an index location for the last
element plus one.
LIST SLICING
Indexing starts at 0. Last element starts with -1
TUPLES
Tuples are immutable (they can not be modified)
SETS
WHAT IS A SEQUENCE?
A sequence contains objects that are kept in a specific order.
You can identify an object in a sequence by its index location.
You can also extract from a sequence with the slicing operation.
Three operations commonly applied to sequences
+ concatenate, * repeat, [ ] fetches a particular
element.