I am a complete amateur and know there probably is easier ways to do this, but this isn't an important project, just a superquick code. For some reason it seems like it gets stuck in a loop because random.choice gives the same number over and over again. It works sometimes, I just have to give it a couple of tries, and as I increase the range the more difficult it is.
The code is supposed to allocate a unique number to each "player" every round, without giving the same player the same number twice.
import random
A = []
B = []
C = []
D = []
E = []
F = []
G = []
H = []
I = []
J = []
K = []
lt = [A, B, C, D, E, F, G, H, I, J, K]
lit = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K']
ALT = 0
for e in range(5):
lst = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
for i in lt:
while True:
add = random.choice(lst)
if add not in i:
i.append(add)
lst.remove(add)
break
else:
print('fant ingenting')
ALT += 1
print(ALT)
tot = 0
for k in lt:
print(str(lit[tot]) + ' = ' + str(k))
tot += 1