4
My teacher asked me to generate a mega sena bet generator. I did, and modesty part turned out 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('\033[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('\033[1;32m >>>>> BOA SORTE <<<<<< ')
print('Fim')
print('\033[31m^'*45)
But then a question came to me: I am a player until I am a regular of the mega sena (at least 1 time 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 didn’t work. It didn’t go wrong, it seems like it was running, but I’m not sure. I waited about 5 minutes, and nothing. Is it really impossible, or is my program simply wrong?
I’m using the Pycharm.
for some reason, this question was extremely messy. I don’t know what happened, since when I was writing it was well formatted
– Douglas Eduardo
Being a regular player, you should know that the probability of selling is extremely small, I entered is normal that it takes until two draws are equal.
– Woss
Welcome to Stack Overflow, Douglas! I saw that you added new questions to this, already answered - I would suggest that you mark the answer below as accepted by clicking the arrow, or if you have any secondary questions, make a comment/ask for clarification; regarding your new questions, please create a new question, trying to present one problem at a time - the purpose is to keep the site organized, and that other users can use your question and answers to learn as well! :)
– Daniel
I took the liberty of reversing your edit - you can click on the link edited... to review the text you had written, if you want to repurpose for a new question - thank you for understanding!
– Daniel
Blogger, I read your comment and thank you deeply for the corrections. Thank you very much, and nice presentation on your profile. Worthy of approval by the faculty of Sirius. DO NOT PANIC!!!. I want to mark this answer as accepted. You asked me to click the arrow... What arrow?
– Douglas Eduardo
In the answer, in the upper left corner there is an arrow up
upvote
, the votes that were cast (at time 5), an arrow downdownvote
and below a check mark✓
- click on it; for people to receive notification of their comment here, type their name with a @before, for example: @Blogger– Daniel