''' Purpose: introduce lists ''' import pause # get text and convert to list form reply = input( 'Enter text: ' ) strings = reply.split() print( 'reply =', reply ) print( 'strings =', strings ) print() # get text and convert to list form reply = input( 'Just hit enter: ' ) print() strings = reply.split() print( 'reply =', reply ) print( 'strings =', strings ) pause.enter_when_ready() # get text and convert to list form and print words one by one reply = input( 'Enter text: ' ) strings = reply.split() for s in strings: # s will take on each word in strings print(s) pause.enter_when_ready() # get numeric text and convert to numbers reply = input( 'Enter a list of numbers: ' ) numeric_strings = reply.split() print( 'reply =', reply ) print( 'strings =', strings ) pause.enter_when_ready() total = 0 for ns in numeric_strings: n = int(ns) total = total + n print( numeric_strings, total ) pause.enter_when_ready() # get numeric text and convert to numbers reply = input( 'Enter a list of numbers: ' ) nbrs = reply.split() print( 'reply =', reply ) print( 'nbrs =', nbrs ) pause.enter_when_ready() n = len( nbrs ) numbers = [] for ns in nbrs: n = int(ns) numbers.append(n) print(numbers)