So I created this program that shows numbers in a list in a random order but it only shows half of the numbers:
import random
import time
names = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
for x in names:
y = random.choice(names)
print (y)
names.remove(y)
Can somebody tell me what’s wrong here?
submitted by /u/Valerio123456
[link] [comments]
r/learnpython So I created this program that shows numbers in a list in a random order but it only shows half of the numbers: import random import time names = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26] for x in names: y = random.choice(names) print (y) names.remove(y) Can somebody tell me what’s wrong here? submitted by /u/Valerio123456 [link] [comments]
So I created this program that shows numbers in a list in a random order but it only shows half of the numbers:
import random
import time
names = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]
for x in names:
y = random.choice(names)
print (y)
names.remove(y)
Can somebody tell me what’s wrong here?
submitted by /u/Valerio123456
[link] [comments]