Q:

How to print a word thats in a string thats in a list? in Python

I'm new to python and would greatly appreciate some help.
This is actually a part of a larger function but I am basically trying to call a word from a string that is in a list.
Here's an example I came up with:
words = ['i am sam', 'sam i am', 'green eggs and ham']
for x in words:
    for y in x:
        print(y)

this prints every character:
i

a
m

s
a
m

s
a
m

i

a
m... etc.

but I want every word(the spaces do not matter):
i
am
sam

sam
i
am....etc.

A:

Try this:

for x in words:
    for y in x.split(' '):
        print y

