My teacher asked me to generate a mega sena generator. I did, and modesty part was pretty cool:
from time import sleep
from random import sample
palpite = list()
a = []
print('='*40)
print('=========PALPITES DA MEGA SENA==========')
print('='*40)
print()
sleep(0.1)
c = []
cont = 0
for i in range(1,61):
c.append(i)
pergunta = int(input('3[35mQuantos palpites deseja processar? '))
for j in range(0, pergunta):
palpite.append(sample(c,6))
print()
palpite.sort()
sleep(1)
print('=-'*30)
print('#'*35)
print(f'sortendo {pergunta} numeros')
print('#'*35)
print('=-'*30)
print()
sleep(1.5)
for d in palpite:
d.sort()
cont += 1
sleep(1)
print(f'{cont}º Jogo = {d}')
sleep(1.5)
print()
print('-='*30)
print('3[1;32m >>>>> BOA SORTE <<<<<< ')
print('Fim')
print('3[31m^'*45)
But then a question came to me: I am a player until I am assiduous on the mega seine (at least once a week I make a bet). Is it really possible to win? Then I created a program to test:
from random import sample
numero1 = []
numero2 = []
jogo1 = []
jogo2 = []
for n1 in range(1,61):
numero1.append(n1)
for n2 in range(1,61):
numero2.append(n2)
while True:
jogo1.append(sample(numero1,6))
jogo2.append(sample(numero2,6))
for m in jogo1:
m.sort()
for z in jogo2:
z.sort()
if m == z:
print(m)
print(z)
break
print('fim')
But it did not. There was no error, it seems to have been running, but I'm not sure. I waited about 5 minutes, and nothing. Is it really impossible, or is my program just wrong?
I'm using PyCharm.