Re: [Tutor] Need help understanding output...

2010-08-18 Thread Laurens Vets
Thank you all for your help! I've added another condition to this program, namely, in a range of 60, each 'random' number can only occur 10 times. I came up with the following: import random series = [] for i in range(60): temp = [random.randint(1, 6)] while series[-2:-1] == series[-1:

Re: [Tutor] Need help understanding output...

2010-08-18 Thread Laurens Vets
On 8/12/2010 1:26 AM, Steven D'Aprano wrote: On Thu, 12 Aug 2010 07:04:15 am Laurens Vets wrote: I need to generate a list of 30 numbers randomly chosen from 1, 2, 3, 4, 5& 6. However, I cannot have more than 2 numbers which are the same next to each other. I came up with the

[Tutor] Need help understanding output...

2010-08-11 Thread Laurens Vets
Hello list, I'm learning Python and I'm currently facing an issue with a small script I'm writing. I need to generate a list of 30 numbers randomly chosen from 1, 2, 3, 4, 5 & 6. However, I cannot have more than 2 numbers which are the same next to each other. I came up with the following (P