''' Purpose: continue string manipulation introduction ''' print() # operator + when given two string operands produces their concatenation; # i.e., a new string that is formed by running the two operands together print( "### operator + performs concatenation" ) a = "fire" b = "fighter" c = a + b # 'fire'+'fighter' -> 'firefighter' (concatenated strings) print( "a =", a ) print( "b =", b ) print() print( "a + b =", c ) print() # operator * when one of its operands is a string and the other is an integer, # produces a new string that is a repeated concatenation of string operand # indicated by the integer print( "### * operator produces repeated concatenation" ) m = "Wahoo-Wah!" n = 3 # mn is "Wahoo-Wah!"*3 and nm is 3*"Wahoo-Wah!" and it does the same thing (order doesn't matter) mn = m * n # 'Wahoo-Wah!Wahoo-Wah!Wahoo-Wah!' (glues multiple copies of the string together) nm = n * m # 'Wahoo-Wah!Wahoo-Wah!Wahoo-Wah!' print( "m = ", m ) print( "n = ", n ) print() print( "m * n =", nm ) print( "n * m =", nm )