Untitled

mail@pastecode.io avatar
unknown
python
a year ago
843 B
9
Indexable
Never
import random
nomi,clan,reparto,branco=[],[],[],[]
branche=[reparto,clan,branco]
with open("Persone.txt") as f:
    nomi=f.readlines()

totale=0
zeri=0
for i in nomi:
    if i[0].isalpha():
        totale+=1
        branche[zeri].append(i)
    elif i[0]=='0':
        zeri+=1
for i in nomi:
    if i[0].isdigit():
        nomi.remove(i)
    elif i=="\n":
        nomi.remove("\n")

numsq=8
team=["Leoni Dorati","Trote Rosse","Lupi Bianchi","Draghi verdi","Falchi Azzurri","Grifoni Arancioni","Piovre Nere","Orsi viola"]
squadre=[]
[squadre.append([]) for i in range(numsq)]

cont=0
print(nomi)
while len(nomi)>0:

    t=nomi[0]
    if t=="\n" or t[0].isdigit():
        nomi.remove(t)

    squadre[cont].append(t[:-3])

    nomi.remove(t)

    cont+=1
    if cont==numsq:
        cont=0
print(squadre)
for i in squadre:
    print(len(i),*i)