Created
February 11, 2019 16:45
-
-
Save jangia/4897d3747c6ab9d678bdacd8f39b9a48 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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