Re: [Tutor] Random order program

2011-11-28 Thread Christian Witts
On 2011/11/28 11:37 AM, Peter Otten wrote: Christian Witts wrote: Is there anything wrong with just doing the following ? from random import shuffle # just type words with space separating the items # ie. one two three four five words = input('Please enter a list of words: ') word_list = words

Re: [Tutor] Random order program

2011-11-28 Thread Peter Otten
Christian Witts wrote: > Is there anything wrong with just doing the following ? > > from random import shuffle > # just type words with space separating the items > # ie. one two three four five > words = input('Please enter a list of words: ') > word_list = words.split() > print word_list > shu

Re: [Tutor] Random order program

2011-11-28 Thread Alan Gauld
On 28/11/11 08:57, Christian Witts wrote: Is there anything wrong with just doing the following ? No, it's what we were trying to get the OP to discover for himself :-) -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___

Re: [Tutor] Random order program

2011-11-28 Thread Christian Witts
On 2011/11/28 12:17 AM, myles broomes wrote: I requested help for this code earlier and I thought it had been corrected but apparently, there is still a problem with it... #random word order program #the user gives the program a list of words #the program then returns them in a random order im

Re: [Tutor] Random order program

2011-11-28 Thread Alan Gauld
On 28/11/11 07:57, Charles Becker wrote: A way to make the code more 'pythonic' and easier to read might be to replace the conditional while len(random_word_list) != len(word_list) With the following : for x in range(len(word_list)) Unfortunately that won't work with the OPs alg

Re: [Tutor] Random order program

2011-11-28 Thread Charles Becker
Dave, Myles, et al, On Nov 27, 2011, at 4:25 PM, Dave Angel wrote: > On 11/27/2011 05:17 PM, myles broomes wrote: >> >> >> >> >> >> >> >> #random order list >> while len(random_word_list) != len(word_list): >> word = random.choice(word_list) >> if word not in random_word_l

Re: [Tutor] Random order program

2011-11-27 Thread Dave Angel
On 11/27/2011 05:17 PM, myles broomes wrote: I requested help for this code earlier and I thought it had been corrected but apparently, there is still a problem with it... To start with, tell us what version of Python, and what operating system platform you're using. I'm assuming Python 3.x a

Re: [Tutor] Random order program

2011-11-27 Thread Andreas Perstinger
On 2011-11-27 23:17, myles broomes wrote: #get the users input for the list of words, one by one first_word = input("Please enter your first word: ") second_word = input("Please enter your second word: ") third_word = input("Please enter your third word: ") fourth_word = input("Please enter your

[Tutor] Random order program

2011-11-27 Thread myles broomes
I requested help for this code earlier and I thought it had been corrected but apparently, there is still a problem with it... #random word order program #the user gives the program a list of words #the program then returns them in a random order import random #explain the purpose of the progra

Re: [Tutor] Random order program

2011-11-27 Thread bob gailer
On 11/27/2011 11:28 AM, myles broomes wrote: Im trying to make a program where the user enters 5 words and then the list of words a is returned in a random order. Heres the code I have come up with so far: #random word order program #the user gives the program a list of words #the program then

[Tutor] Random order program

2011-11-27 Thread myles broomes
Im trying to make a program where the user enters 5 words and then the list of words a is returned in a random order. Heres the code I have come up with so far: #random word order program #the user gives the program a list of words #the program then returns them in a random order import random