''' Purpose: continue string manipulation introduction ''' # String Concatenation works with ONLY STRINGS # operator + when given a string and non-string operands throws up - doesn't work! #water = 'H' + 2 + 'O' # You can't concatenate a string and a number! You can only concatenate strings! #print( water ) # built-in function str() returns a text representatiom of its argument water = 'H' + str( 2 ) + 'O' # This one will work because you're concatenating 3 strings! 'H' + '2' + 'O' -> 'H2O' print( water ) # To highlight Professor Cohoon's point about printing with + vs. commas # + - strings # , - different types # Code # Console # print('H'+'2'+'O') -> H2O # Concatenated strings # print('H', 2, 'O') #-> H 2 O # Commas for different types (strings and number) - items are separated by spaces # when printed # This is just an example ^