# StringManipulationsMore.java (c) Kari Laitinen # http://www.naturalprogramming.com # 2006-04-24 File created. # 2022-12-16 Converted to Python 3. # For more information about slicing, see pythonfilesextra\Slicings.py first_string = "AAABBBCCCDDD" second_string = "xxxyyyzzz" print( "\n CHARACTER POSITIONS : 01234567890123456" ) print( "\n Original first_string : " + first_string, end="" ) print( "\n Original second_string : " + second_string, end="" ) first_string = second_string[ 0 : 5 ] + \ first_string[ 5 : len( first_string ) ] print( "\n Modified first_string : " + first_string, end="" ) if first_string[ 0 : 5 ] == second_string[ 0 : 5 ] : print( "\n The first five characters in both strings are the same", end="" ) if first_string.find( "CCCD" ) != -1 : print( "\n String \"%s\"includes string \"CCCD\" in index position %d." \ % ( first_string, first_string.find( "CCCD" ) ) )