Skip to content

Instantly share code, notes, and snippets.

@jangia
Created February 11, 2019 16:45
Show Gist options
  • Save jangia/4897d3747c6ab9d678bdacd8f39b9a48 to your computer and use it in GitHub Desktop.
Save jangia/4897d3747c6ab9d678bdacd8f39b9a48 to your computer and use it in GitHub Desktop.
"""
Generiranje n kombinacij dolzine m, pri cemer se lahko eno stevilo uporabi samo v eni kombinaciji
"""
import random
loto_list = []
loto_comb_size = int(raw_input('Vnesi stevilo loto kombinacij: '))
loto_size = int(raw_input('Vnesi stevilo loto stevilk: '))
used_numbers = []
while len(loto_list) < loto_comb_size:
loto_comb = []
while len(loto_comb) < loto_size:
loto_num = random.randint(0, 50)
if loto_num not in used_numbers:
loto_comb.append(loto_num)
used_numbers.append(loto_num)
if len(loto_list) == 0:
loto_list.append(loto_comb)
elif len(set(loto_comb).intersection(set(loto_list[-1]))) == 0:
loto_list.append(loto_comb)
print loto_list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment