From 09d032da1e57b3ce2aa7b9097085f4cf3c2990f3 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Wed, 24 Sep 2025 10:46:27 +0300 Subject: [PATCH] implemented tarot matching --- exercises/match_tarots/match_tarots.ipynb | 48 ++++++++++++++++++----- 1 file changed, 38 insertions(+), 10 deletions(-) diff --git a/exercises/match_tarots/match_tarots.ipynb b/exercises/match_tarots/match_tarots.ipynb index c35f220..9712ab3 100644 --- a/exercises/match_tarots/match_tarots.ipynb +++ b/exercises/match_tarots/match_tarots.ipynb @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "cf05b9c4", "metadata": {}, "outputs": [ @@ -36,9 +36,9 @@ "output_type": "stream", "text": [ "-- Deck 1: --\n", - " ['The Lovers', 'Temperance', 'The Emperor', 'The Sun', 'The Fool', 'The Chariot', 'Death', 'Strength', 'Justice', 'The Star', 'Judgement', 'The World', 'The Tower', 'The Hanged Man', 'The Empress', 'The Hermit', 'The Devil', 'The High Priestess', 'The Moon', 'The Hierophant', 'Wheel of Fortune', 'The Magician']\n", + " ['The Star', 'Justice', 'The Hanged Man', 'The Magician', 'The Hierophant', 'The High Priestess', 'The Chariot', 'The Emperor', 'The Fool', 'The Tower', 'The Devil', 'Strength', 'Judgement', 'The Moon', 'The Empress', 'The World', 'Wheel of Fortune', 'Death', 'The Lovers', 'The Sun', 'Temperance', 'The Hermit']\n", "-- Deck 2: --\n", - " ['The Fool', 'Death', 'The Hermit', 'Strength', 'The Moon', 'Wheel of Fortune', 'Judgement', 'The Lovers', 'The Star', 'The Hanged Man', 'The Empress', 'The Emperor', 'The Magician', 'The Tower', 'The Hierophant', 'The Chariot', 'The High Priestess', 'Temperance', 'The World', 'The Devil', 'The Sun', 'Justice']\n" + " ['The Lovers', 'The Chariot', 'Strength', 'The High Priestess', 'The Hermit', 'Justice', 'The Fool', 'Death', 'The Emperor', 'The Devil', 'The Star', 'The Sun', 'Judgement', 'The Hanged Man', 'The Hierophant', 'Wheel of Fortune', 'The Moon', 'The Magician', 'The Empress', 'Temperance', 'The Tower', 'The World']\n" ] } ], @@ -69,19 +69,47 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "48eb31e2", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "ename": "_IncompleteInputError", + "evalue": "incomplete input (4127308383.py, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m Cell \u001b[0;32mIn[2], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m dict(keys = deck1, values = range(len(deck1))\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31m_IncompleteInputError\u001b[0m\u001b[0;31m:\u001b[0m incomplete input\n" + ] + } + ], + "source": [ + "dict(keys = deck1, values = range(len(de" + ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "509dda71", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{(15, 21), (11, 2), (8, 6), (10, 9), (9, 20), (12, 12), (20, 19), (4, 14), (5, 3), (14, 18), (19, 11), (0, 10), (1, 5), (6, 1), (18, 0), (13, 16), (2, 13), (16, 15), (17, 7), (3, 17), (21, 4), (7, 8)}\n" + ] + } + ], + "source": [ + " deck1_dict = {key:value for key,value in zip(deck1, list(range(len(deck1))))}\n", + " deck2_dict = {key:value for key,value in zip(deck2, list(range(len(deck1))))}\n", + "result = set()\n", + "for card in tarot_cards:\n", + " result.add((deck1_dict[card], deck2_dict[card]))\n", + "\n", + "print(result)\n", + " " + ] } ], "metadata": { @@ -100,7 +128,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.13.6" } }, "nbformat": 4,