Name: Anonymous 2010-10-04 10:21
I have a words.txt file that looks like:
the
of
and
to
And a python script that looks like:
import random
y = ""
z = 0
openfile = open('words.txt', 'r')
contents = openfile.read()
openfile.close()
print contents
for i in range (len(contents)):
x = random.choice(contents)
if x == """
""":
y == """
"""
else:
y = ""
print x
z = z + 1
while x != y:
y = raw_input('>>>')
print z
I want the output to be the full words, but it outputs just letter like:
o
>>>o
o
>>>o
a
>>>a
n
>>>n
t
>>>t
e
>>>e
h
>>>h
Any help?
the
of
and
to
And a python script that looks like:
import random
y = ""
z = 0
openfile = open('words.txt', 'r')
contents = openfile.read()
openfile.close()
print contents
for i in range (len(contents)):
x = random.choice(contents)
if x == """
""":
y == """
"""
else:
y = ""
print x
z = z + 1
while x != y:
y = raw_input('>>>')
print z
I want the output to be the full words, but it outputs just letter like:
o
>>>o
o
>>>o
a
>>>a
n
>>>n
t
>>>t
e
>>>e
h
>>>h
Any help?