Random and pick from those | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Random and pick from those

How do i make a list numbers from 1-64 make them randomize and then pick 7 out of those 64 numbers?

5th Mar 2017, 10:57 PM
Lazar Varagic
Lazar Varagic - avatar
3 Answers
+ 1
for i in range(100): print(random.randint(1,64)) or, if you insist on having a list. nums=[] for i in range(64): nums.append(i+1) for i in range(7): print(random.choice(nums)) read about for loops, they are your friend
6th Mar 2017, 12:20 AM
LordHill
LordHill - avatar
0
Why don't you use random module?
5th Mar 2017, 10:58 PM
Twelfty
Twelfty - avatar
0
hahah @leakyegg yes they are thank you
6th Mar 2017, 6:32 AM
Lazar Varagic
Lazar Varagic - avatar