Title: generate random number Post by: Kostelooscoin on February 17, 2023, 12:43:28 PM hi possible to generate a number by deleting what has already been generated in python without list
try : Code: import random result File "1.py", line 12, in <module> elements.remove(selection) AttributeError: 'str' object has no attribute 'remove' Title: Re: generate random number Post by: ABCbits on February 17, 2023, 01:00:38 PM I don't know what is your main goal. But i did quick change to your code and this should do what you want.
Code: import random Here's snippet of the output, Code: 22 Title: Re: generate random number Post by: Kostelooscoin on February 17, 2023, 01:05:15 PM perfect thank you very much ;)
Title: Re: generate random number Post by: witcher_sense on February 17, 2023, 01:07:56 PM Code: from random import shuffle 1) Create a list of numbers from 0 to 99 2) Shuffle them with one of functions from random module 3) Pop the last item from the list until it is empty Please note that random uses pseudorandom algorithm, for any serious randomization use secrets module or os.urandom(). Title: Re: generate random number Post by: Kostelooscoin on February 18, 2023, 01:37:27 PM Code: from random import shuffle 1) Create a list of numbers from 0 to 99 2) Shuffle them with one of functions from random module 3) Pop the last item from the list until it is empty Please note that random uses pseudorandom algorithm, for any serious randomization use secrets module or os.urandom(). without 0 |