import random
numbers = list(range(1,46))
random.shuffle(numbers)
print( numbers[:6] )
It's a method of randomly picking 6 numbers between 1 and 45. We can do this six times. Find the most extracted number here.
from collections import Counter
Counter([1,2,3,4,5,5,5,5])
I think it'd be good to use that.
I heard that you use repetitive sentences
import random
from collections import Counter
number_list = list(range(1, 46))
count = Counter()
for i in range(6):
lotto = random.sample(number_list, 6) # Extract 6 from list
count.update(lotto)
common = [m[0] for m in count.most_common(6)]
print(common)
578 Understanding How to Configure Google API Key
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
© 2024 OneMinuteCode. All rights reserved.