On 02/03/14 18:14, Emeraude kwilu wrote:

selectWord = [ "abjuring",] #this is the random word selected
validWordList = ['bar','bug'...]

Obviously this is not your real code since this is not
valid syntax. And since its clearly homework it will help
us if you post your actual code that is failing plus
any error messages(in  their entirety)


randWord = random.choice(selectWord)

time.time () = now
count = 0
while time() <= now +30:
       print raw_input("enter a word in abjuring:")

You need to store the word that the user entered. Here you
just print it then throw it away. You will need another
variable, and probably a list as well, to hold the
previous words entered.

       count += 1

I am stuck there my loop is not working

Define 'not working'
What is happening?
What did you expect to happen?

Being precise in your descriptions is very important.
Often describing the problem in detail is enough for you
to find the answer to it yourself!

and I don't know how to print the user word ether

You seem to be printing the word the user entered OK,
That is all you are doing with it in fact.
What you are not doing is comparing it to the valid
words list. That's where your if/else code should
come in.

I have to print the number of the valid word the enter and print it also
if they print invalid word I have to print it as well

at the end I prunt all the valid word. I know I have to use if and else
statement but I'm not able to do so :(

Show us your actual code plus any error messages.

It won't do any harm to tell us the python version too, it's obviously Python 2.X but what is X? 2.5, 2.6 or 2.7?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to