Python Programming quick reference
Strings: #string concatenation >>> first_name = 'Yu' >>> last_name = 'Zhang' >>> full_name = first_name + ' ' + last_name >>> print(full_name) Yu Zhang #string repetition >>> print(5*'-' + 'hello world' + 5*'-') -----hello world----- #string indexing(positive + negative indice) >>> full_name 'Yu Zhang' >>> full_name[1] 'u' >>> full_name[-1] 'g' #string slicing(range, instead of a single character) #[beginning index: ending index] #element referenced by beginning index is always included #element referenced by ending index is always excluded #to get the end, leave ending index blank >>> full_name[3:] 'Zhang' >>> full_name[3:7] 'Zhan' #Python stings are immutable, meaning they cannot be changed >>> full_name[2] = '