Python 07 - String Manipulation
String - a sequence of characters.
This definition implies that the characters in a string are in order and that they each have a position or index.
String indexing begins at zero, so the first character in the string has an index of 0, the second has an index of 1, and so on.
So a string that is n characters long will have indexes 0 through n-1
Square brackets [] are used next to the string, and the index of the character you want, goes next to the string.
Getting One Character [index]
Getting Multiple Characters [start:stop]
To get multiple consecutive characters, you can put two numbers in the brackets.
The first number is where you want to start, and the second number is where you want to stop.
***The stop number is EXCLUSIVE, so you wonβt get that character, youβll only get up the character right before it.
Getting Multiple Characters [start:stop:step]
To get multiple non-consecutive characters, you can put a third number in the brackets.
The third number is for step.
The len() Function
takes an object as an argument, returns the length or number of items in that object