''' Purpose: separately prompt for a string s and a list of integers numbers. The program displays the string formed by using numbers as indices into s. ''' word = input( "Enter a string: ") reply = input( 'Enter a list of numbers: ') numeric_strings = reply.split() numbers = [] for ns in numeric_strings: n = int( ns ) numbers.append( n ) # ready to solve the problem answer = '' for nbr in numbers: character = word[ nbr ] # word[nbr] gives the character at the index corresponding to nbr in the string word #print( character ) answer = answer + character print( answer )