From 75bb75562d275500b81a254f0bfc2d7886bc4657 Mon Sep 17 00:00:00 2001 From: Montserrat Labrada Date: Sun, 2 Oct 2022 23:37:17 -0400 Subject: [PATCH] Mandar Challenge 1 terminado --- your-code/challenge-1.ipynb | 59 ++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 11 deletions(-) diff --git a/your-code/challenge-1.ipynb b/your-code/challenge-1.ipynb index 4302084..a03e114 100644 --- a/your-code/challenge-1.ipynb +++ b/your-code/challenge-1.ipynb @@ -38,7 +38,10 @@ "outputs": [], "source": [ "str_list = ['Durante', 'un', 'tiempo', 'no', 'estuvo', 'segura', 'de', 'si', 'su', 'marido', 'era', 'su', 'marido']\n", - "# Your code here:\n" + "# Your code here:\n", + "str_list.append('.')\n", + "' '.join(str_list)\n", + " " ] }, { @@ -55,7 +58,13 @@ "outputs": [], "source": [ "food_list = ['Bananas', 'Chocolate', 'bread', 'diapers', 'Ice Cream', 'Brownie Mix', 'broccoli']\n", - "# Your code here:\n" + "# Your code here:\n", + "food_list=[i.lower() for i in food_list]\n", + "print(food_list)\n", + "Grocery_list=list(filter(lambda i: i.startswith('b'), food_list))\n", + "print(Grocery_list)\n", + "Grocery_list.append('.')\n", + "print(Grocery_list)\n" ] }, { @@ -88,9 +97,11 @@ " # Sample Output: 78.53981633\n", " \n", " # Your code here:\n", + " pi = math.pi\n", + " area = pi * radius * radius\n", " \n", - " \n", - "# Your output string here:" + "# Your output string here:\n", + "print(string1 + ' ' + str(radius) + \" \" + string2 + ' ' + str(area))" ] }, { @@ -120,7 +131,17 @@ "Is also great\n", "And would suffice.\"\"\"\n", "\n", - "# Your code here:\n" + "# Your code here:\n", + "import string\n", + "stripped=poem.translate(str.maketrans('', '', string.punctuation))\n", + "\n", + "print(stripped.split())\n", + "\n", + "poem_splitted=stripped.split()\n", + "\n", + "from collections import Counter\n", + "\n", + "Counter(poem_splitted)" ] }, { @@ -158,7 +179,21 @@ "In the morning glad I see; \n", "My foe outstretched beneath the tree.\"\"\"\n", "\n", - "# Your code here:\n" + "# Your code here:\n", + "import string\n", + "stripped=poem.translate(str.maketrans('', '', string.punctuation))\n", + "stripped.lower()\n", + "stripped_lower=stripped.lower()\n", + "print(stripped_lower)\n", + "\n", + "words_dont_appear=[]\n", + "word=0\n", + "for i in blacklist:\n", + " if stripped_lower.find(i):\n", + " print(i)\n", + " else:\n", + " words_dont_appear.append(word!=i)\n", + " print(words_dont_appear)" ] }, { @@ -179,7 +214,8 @@ "poem = \"\"\"The apparition of these faces in the crowd;\n", "Petals on a wet, black bough.\"\"\"\n", "\n", - "# Your code here:\n" + "# Your code here:\n", + "''.join([i for i in poem if i.isupper()])" ] }, { @@ -197,7 +233,8 @@ "source": [ "data = ['123abc', 'abc123', 'JohnSmith1', 'ABBY4', 'JANE']\n", "\n", - "# Your code here:\n" + "# Your code here:\n", + "data.find(\"123\")" ] }, { @@ -224,7 +261,7 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -238,9 +275,9 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.7.2" + "version": "3.9.12" } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 }