lista5-ex4.py
Click here to get the file
Size
1 kB
-
File type
text/python-source
File contents
from random import randint, shuffle
unidades = [0,1,2,3,4,5,6,7,8,9]
dezenas = [0,1,2,3,4,5,6,7,8,9]
listaSorteados = []
sorteadas = 0
while sorteadas <= 5:
#embaralhando listas:
shuffle(unidades)
shuffle(dezenas)
u = randint(0,9)
d = randint(0,9)
if u != 0 and d != 0:
numero = int("%d%d"%(d,u))
else: #saiu 00, considerar 100
numero = 100
if numero not in listaSorteados:
print("Numero sorteado: %d"%(numero))
listaSorteados.append(numero)
sorteadas += 1
#else:
# print("Repetiu o numero ", numero)