From 4eb81618c2529d9336ca271b04f96ea9e86da64e Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Wed, 24 Sep 2025 10:43:48 +0300 Subject: [PATCH] solution --- exercises/match_tarots/match_tarots.ipynb | 39 +++++++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/exercises/match_tarots/match_tarots.ipynb b/exercises/match_tarots/match_tarots.ipynb index c35f220..8420fac 100644 --- a/exercises/match_tarots/match_tarots.ipynb +++ b/exercises/match_tarots/match_tarots.ipynb @@ -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 World', 'Wheel of Fortune', 'The Chariot', 'The Magician', 'The Hierophant', 'The Lovers', 'Judgement', 'Death', 'The Empress', 'The Hanged Man', 'The Hermit', 'The Star', 'Strength', 'The Sun', 'Temperance', 'The Devil', 'The Emperor', 'The High Priestess', 'The Moon', 'Justice', 'The Tower', 'The Fool']\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 Moon', 'The Fool', 'The Hanged Man', 'The Empress', 'The Tower', 'Strength', 'Temperance', 'The Magician', 'Judgement', 'Wheel of Fortune', 'The Devil', 'Justice', 'The Lovers', 'The Hierophant', 'The Chariot', 'The Sun', 'Death', 'The Star', 'The High Priestess', 'The Emperor', 'The World', 'The Hermit']\n" ] } ], @@ -69,16 +69,41 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "48eb31e2", "metadata": {}, - "outputs": [], - "source": [] + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[(0, 20), (1, 9), (2, 14), (3, 7), (4, 13), (5, 12), (6, 8), (7, 16), (8, 3), (9, 2), (10, 21), (11, 17), (12, 5), (13, 15), (14, 6), (15, 10), (16, 19), (17, 18), (18, 0), (19, 11), (20, 4), (21, 1)]\n" + ] + } + ], + "source": [ + "pairs = []\n", + "for idx1, card1 in enumerate(deck1):\n", + " for idx2, card2 in enumerate(deck2):\n", + " if card1 == card2:\n", + " pairs.append((idx1, idx2))\n", + "\n", + "print(pairs)\n", + " " + ] + }, + { + "cell_type": "markdown", + "id": "9c15f5b0-373c-4ae6-82c5-efc97a95f0a5", + "metadata": {}, + "source": [ + "O(n^2)" + ] }, { "cell_type": "code", "execution_count": null, - "id": "509dda71", + "id": "622c6741-accc-484b-99dc-e0dda1fc1193", "metadata": {}, "outputs": [], "source": [] @@ -100,7 +125,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.13.6" } }, "nbformat": 4, -- 2.39.5