On 11/23/2016 11:17 AM, Thomas Grops wrote:
I need a way of generating a random number but there is a catch:
I don't want to include certain numbers, is this possible?
random.randint(1,100) works as it will randomly pick numbers between 1 and 100
but say i don't want 48 to come out is there a
Thankyou for all your help I have managed to pick a way that works from your
suggestions :D
--
https://mail.python.org/mailman/listinfo/python-list
On 2016-11-23 19:29, Chris Kaynor wrote:
On Wed, Nov 23, 2016 at 11:17 AM, Thomas Grops via Python-list
wrote:
I need a way of generating a random number but there is a catch:
I don't want to include certain numbers, is this possible?
random.randint(1,100) works as it will randomly pick numbe
On Wednesday, 23 November 2016 19:30:21 UTC, Chris Kaynor wrote:
> On Wed, Nov 23, 2016 at 11:17 AM, Thomas Grops via Python-list
> wrote:
> > I need a way of generating a random number but there is a catch:
> >
> > I don't want to include certain numbers, is this possible?
> >
> > random.randint
On Wednesday, 23 November 2016 19:30:04 UTC, Thomas Nyberg wrote:
> On 11/23/2016 02:17 PM, Thomas Grops via Python-list wrote:
> > I need a way of generating a random number but there is a catch:
> >
> > I don't want to include certain numbers, is this possible?
> >
> > random.randint(1,100) work
You can use a while statement until you get a number out of your
excluded numbers
excludedNumbers = [1,2,3,4]
randomNumber = random.randomint(1,100)
while randomNumber in excludedNumbers:
randomNumber = random.randomint(1,100)
After the while you have a number outside the excluded nu
On Wed, Nov 23, 2016 at 11:17 AM, Thomas Grops via Python-list
wrote:
> I need a way of generating a random number but there is a catch:
>
> I don't want to include certain numbers, is this possible?
>
> random.randint(1,100) works as it will randomly pick numbers between 1 and
> 100 but say i do
On 11/23/2016 02:17 PM, Thomas Grops via Python-list wrote:
I need a way of generating a random number but there is a catch:
I don't want to include certain numbers, is this possible?
random.randint(1,100) works as it will randomly pick numbers between 1 and 100
but say i don't want 48 to come
Thomas Grops :
> random.randint(1,100) works as it will randomly pick numbers between 1
> and 100 but say i don't want 48 to come out is there a way of doing
> this. It needs to be an integer too so not a list unless there is a way
> to convert list to int
r = 48
while r == 48:
r = r
I need a way of generating a random number but there is a catch:
I don't want to include certain numbers, is this possible?
random.randint(1,100) works as it will randomly pick numbers between 1 and 100
but say i don't want 48 to come out is there a way of doing this. It needs to
be an integer
10 matches
Mail list logo