Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,37 @@ def select_numbers(select_amount:int):

lotto = [1,2,3,4,5,6]

## example 1
lotto = []
for i in range(select_amount):

while True:
select_num = random.randint(1, 45)

is_duplicated = False
for num in lotto:
if select_num == num:
is_duplicated = True
break

if is_duplicated:
continue
lotto.append(select_num)
break

## example 2
'''
candidate_numbers = lotto_numbers[:]
lotto = []
for i in range(select_amount):
select_num = candidate_numbers.pop(random.randrange(len(candidate_numbers)))
lotto.append(select_num)
'''

## example 3
'''
lotto = random.sample(lotto_numbers, select_amount)
'''

return lotto

Expand Down