From 68a4f94dbdda17a334cb0893be0867c195289311 Mon Sep 17 00:00:00 2001 From: ASPP Student Date: Wed, 24 Sep 2025 10:52:24 +0300 Subject: [PATCH] Add solution --- exercises/match_tarots/match_tarots.ipynb | 64 ++++++++++++++++++++--- 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/exercises/match_tarots/match_tarots.ipynb b/exercises/match_tarots/match_tarots.ipynb index c35f220..842b542 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 Empress', 'The Hermit', 'Death', 'Justice', 'The Magician', 'The Lovers', 'Wheel of Fortune', 'The Fool', 'The Tower', 'The Hierophant', 'The World', 'The Moon', 'Judgement', 'The Chariot', 'The Sun', 'The High Priestess', 'Strength', 'The Hanged Man', 'The Emperor', 'The Devil', 'Temperance', 'The Star']\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" + " ['Justice', 'Temperance', 'The Hanged Man', 'Strength', 'The Magician', 'The Tower', 'Wheel of Fortune', 'The Moon', 'The Lovers', 'The Fool', 'Judgement', 'The Star', 'Death', 'The Hierophant', 'The Empress', 'The High Priestess', 'The Hermit', 'The Sun', 'The Chariot', 'The Devil', 'The Emperor', 'The World']\n" ] } ], @@ -69,16 +69,66 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "48eb31e2", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "set1 = set(deck1)\n", + "\n", + "matching = []\n", + "\n", + "for indx, card in enumerate(deck2):\n", + " if card in set1:\n", + " matching.append((deck2.index(card), deck1.index(card)))" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "509dda71", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "[(0, 3),\n", + " (1, 20),\n", + " (2, 17),\n", + " (3, 16),\n", + " (4, 4),\n", + " (5, 8),\n", + " (6, 6),\n", + " (7, 11),\n", + " (8, 5),\n", + " (9, 7),\n", + " (10, 12),\n", + " (11, 21),\n", + " (12, 2),\n", + " (13, 9),\n", + " (14, 0),\n", + " (15, 15),\n", + " (16, 1),\n", + " (17, 14),\n", + " (18, 13),\n", + " (19, 19),\n", + " (20, 18),\n", + " (21, 10)]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "matching" + ] }, { "cell_type": "code", "execution_count": null, - "id": "509dda71", + "id": "50d68467", "metadata": {}, "outputs": [], "source": [] @@ -86,7 +136,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" }, @@ -100,7 +150,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.5" + "version": "3.13.6" } }, "nbformat": 4, -- 2.39.5