''' Purpose: convert an input list of integers into an integer list ''' # get input reply = input( 'Enter integers: ' ) print() # split reply into list of numeric strings nbr_strings = reply.split() # see what we got print( 'nbr_strings:', nbr_strings ) print() # convert numeric text into list of numbers # set up the accumulator to prepare for adding elements numbers = [] # will correspond the integers that the yser provides. since we are accumulating it. we are going to # build up numbers one at a time. that means the accumulator needs to start off as an empty list. # process the strings of nbr_strings one-by-one for ns in nbr_strings : # process the current numeric string # get numeric equivalent of ns nbr = int( ns ) # get a conversion of string ns as n integer # add equivalent to list of numbers numbers.append( nbr ) # add current conversion to numbers. print( "numbers:", numbers ) print() # print the updated list of numbers print( 'numbers:', numbers )