From c33a00a72654733c3c47a7b83f5f4d1e7b096eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aidee=20Jimena=20Nu=C3=B1ez?= Date: Mon, 16 Mar 2026 19:35:22 -0400 Subject: [PATCH] Assignment_1_AJNC --- python-env/Assignment_1_AJNC.ipynb | 203 +++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 python-env/Assignment_1_AJNC.ipynb diff --git a/python-env/Assignment_1_AJNC.ipynb b/python-env/Assignment_1_AJNC.ipynb new file mode 100644 index 000000000..2ee0e75c4 --- /dev/null +++ b/python-env/Assignment_1_AJNC.ipynb @@ -0,0 +1,203 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "2150f740", + "metadata": {}, + "source": [ + "Part 1: Building the base Anagram Checker" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "d03114a0", + "metadata": {}, + "outputs": [], + "source": [ + "# For testing purposes, we will write our code in the function\n", + "def anagram_checker(word_a, word_b):\n", + " if sorted(word_a.lower()) == sorted(word_b.lower()): #I made the words lowercase and ordered them alphabetically to see if they match\n", + " return True\n", + " else:\n", + " return False" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "9fb548cc", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"Silent\", \"listen\")" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "65bb341a", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker(\"Silent\", \"Night\")" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "6ab49975", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "anagram_checker(\"night\", \"Thing\")" + ] + }, + { + "cell_type": "markdown", + "id": "46743fd0", + "metadata": {}, + "source": [ + "Part 2: Expanding the functionality of the Anagram Checker\n" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "d754360e", + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "def anagram_checker_S(word_a, word_b, is_case_sensitive):\n", + " if not is_case_sensitive: #if is sensitive is false, it is converted to lowercase \n", + " word_a = word_a.lower()\n", + " word_b = word_b.lower()\n", + "\n", + " if sorted(word_a) == sorted(word_b): #ordered them alphabetically\n", + " return True\n", + " else:\n", + " return False " + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "4e539e5d", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "True" + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker_S(\"Silent\", \"listen\", False)" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "f914b000", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "anagram_checker_S(\"Silent\", \"listen\", True) " + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "d86c0703", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "False" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "anagram_checker_S(\"Silent\", \"Listen\", True)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.9" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}