Skip to content
Snippets Groups Projects
17.py 929 B
Newer Older
hacker717's avatar
hacker717 committed
from itertools import product
tr = {"буби": "бубен", "пики": "пик", "трефы": "треф", "черви": "червей"}
types = ("бубен", "пик", "треф", "червей")
nums = ("10", "2", "3", "4", "5", "6", "7", "8", "9", "валет", "дама", "король", "туз")

card_type, card_num = tr[input()], input()
combtorem = input()

prevcomb = ""
f = False
# arr = []
for elem in product(nums, types, repeat=3): 
    a, b, c = f"{elem[0]} {elem[1]}", f"{elem[2]} {elem[3]}", f"{elem[4]} {elem[5]}"
    if a == b or b == c or a == c:
        continue
    if card_type not in elem or card_num in elem:
        continue
    
    comb = ", ".join([a, b, c])
    
    # if len(arr) >= 10:
    #     arr = arr[1:]
    # arr.append(comb)

    if prevcomb == combtorem:
        f = True

    if f and comb.split()[-2] == combtorem.split()[-2]:
        print(comb)
        break

    prevcomb = comb