''' Purpose: demonstrate the printing of a list of words, one word per line ''' # get list of three words reply = input( "Enter three words: " ) w1, w2, w3 = reply.split() ### print the words print() print( w1 ) print( w2 ) print( w3 ) print() # get list of words reply = input( "Enter several words: " ) words = reply.split() # splits the string up into a list of words [w1,w2,w3,...] ### print the words print( words ) # for loopvariable in sequence: # The loop variable (in this case w) will take on each value in the sequence one by one # Sequences include ranges, strings, and lists # The for loop breaks down the sequence into smaller parts # Ranges -> Each number # Strings -> Characters # Lists -> List elements (like our string words in this example) # List For Loop: for w in words: print( w ) s = words[0] # words is a list and we can also subscript into lists to get what's the first element in the sequence # our sequence is the list words # First word in words list! # String For Loop: for ch in s: # for each character in the string s print( ch ) # print each character # Range For Loop (refer to love_is_all_you_need.py) # Ex. for i in range(0,5): # print( i )