""" Purpose: demonstrate basic usage of string [] operator to look at individual characters. """ # Get three indices of user interest reply = input( "Enter three indices: " ) i1, i2, i3 = reply.split() i1 = int ( i1 ) i2 = int ( i2 ) i3 = int ( i3 ) # Initialize target string s = "chrestomathics" # Use the indices to pick off single characters from s c1 = s[ i1 ] # Grab character at index i1 in s c2 = s[ i2 ] # Grab character at index i2 in s c3 = s[ i3 ] # Grab character at index i3 in s # Use the characters to make a new string t = c1 + c2 + c3 # Print the result print() print( t )