Python str (string) is a sequence of characters.
>>> symbol = 'AAPL' >>> type(symbol) <class 'str'>
You can find a character within a string by indexing. Position starts with zero. Negative numbers start from the end of string.
>>> symbol = 'MSFT' >>> symbol[0] 'M' >>> symbol[1] 'S' >>> symbol[-1] 'T'
You can find string length (number of characters) using the len() function.
>>> len('MSFT')
4
>>> len('PyTut')
5
Strings can be typed with single or double quotes. They are equivalent.
>>> single = 'AAPL' >>> double = "AAPL" >>> single == double True
A string can be empty and still a string.
>>> empty = '' >>> type(empty) <class 'str'>