repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
prim: Introduces Python version
[lcapit-junk-code.git]
/
mega-sena.py
blob
65c9fa132d93eafcdbe9010ec897d468c6282913
1
#!/usr/bin/python
2
#
3
# Mega-sena loterry
4
#
5
# Luiz Fernando N. Capitulino
6
# <lcapitulino@gmail.com>
7
8
from
random
import
randint
9
from
sys
import
exit
,
argv
10
11
def
megasena
(
max
):
12
numbers
= []
13
for
i
in
range
(
max
):
14
while True
:
15
val
=
randint
(
1
,
60
)
16
if
val
in
numbers
:
17
continue
18
numbers
.
append
(
val
)
19
break
20
return
numbers
21
22
def
main
():
23
try
:
24
max
=
int
(
argv
[
1
])
25
if
max
<
6
or
max
>
15
:
26
raise
ValueError
27
except
:
28
max
=
6
29
30
print
megasena
(
max
)
31
exit
(
0
)
32
33
if
__name__
==
"__main__"
:
34
main
()