# File: lines.py # Program to print words in a line # NOTE: a "word" is any sequence of non-blank characters # (user enters line) # # Matt Bishop, ECS 10, Fall 2012 # # Break line into words and print the words one per line # parameter: line, the line to be split up def getwords(line): # create a list of words listwords = line.split(" ") # print them out one per line for i in listwords: print(i) # read a line, break it into words, and print the words # calls: function getwords def main(): # get line from user line = input("Type your line: ") # break it into words and print them out getwords(line) main()