Ahoj, pomuze nekdo, kod by mel postupne nahodne zobrazit 6 cisel, nekdy ale zobrazi pouze 4. Myslel jsem, ze smycka while toto osetri,ale zrejme je tam chyba. Mrkne mi prosim nekdo na ten kod. Dekuji (Ani moc nevim, jak jinak osetrit ve While, kdyz neni splnena podminka a cislo uz v Listu je obsazeno).
import random
voted=[]
number1=random.randint(1,6)
while not number1 in voted:
voted.append(number1)
print(voted)
number2=random.randint(1,6)
while not number2 in voted:
voted.append(number2)
print(voted)
number3=random.randint(1,6)
while not number3 in voted:
voted.append(number2)
voted.append(number3)
print(voted)
number4=random.randint(1,6)
while not number4 in voted:
voted.append(number4)
print(voted)
number5=random.randint(1,6)
while not number5 in voted:
voted.append(number5)
print(voted)
number6=random.randint(1,6)
while not number6 in voted:
voted.append(number6)
print(voted)