• Created (come into existence) the first time they appear in assignment statements • When an argument of a print statement – Quotation marks not included in display
String Concatenation • Two strings can be combined to form a new string – Consisting of the strings joined together – Represented by a plus sign • Combination of strings, plus signs, functions, and methods can be evaluated – Called a string expression
Internal Documentation Benefits of documentation 1.Other people easily understand program. 2.You can better understand program when you read it later. 3.Long programs are easier to read – Purposes of individual pieces can be determined at a glance.
Line Continuation • A long statement can be split across two or more lines – End each line with backslash character ( \ ) • Alternatively any code enclosed in a pair of parentheses can span multiple lines. – This is preferred style for most Python programmers
Indexing and Slicing Out of Bounds • Python does not allow out of bounds indexing for individual characters of strings – Does allow out of bounds indices for slices • Given: str1 = “Python” – Then print(str1[7]) print(str1[-7])