diff --git a/your-code/main.ipynb b/main.ipynb similarity index 50% rename from your-code/main.ipynb rename to main.ipynb index de27676..3d5d9aa 100644 --- a/your-code/main.ipynb +++ b/main.ipynb @@ -9,13 +9,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "words = ['play', 'filling', 'bar', 'theatre', 'easygoing', 'date', 'lead', 'that', 'story', 'island']" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] + }, { "cell_type": "markdown", "metadata": {}, @@ -25,11 +30,30 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "PLAY\n", + "FILLING\n", + "BAR\n", + "THEATRE\n", + "EASYGOING\n", + "DATE\n", + "LEAD\n", + "THAT\n", + "STORY\n", + "ISLAND\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "for elemen in words:\n", + " print(elemen.upper())" ] }, { @@ -41,11 +65,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "['filling', 'theatre', 'easygoing', 'story', 'island']\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "new_list = []\n", + "for elemen in words:\n", + " if len(elemen) >= 5:\n", + " new_list.append(elemen)\n", + "print(new_list)\n" ] }, { @@ -59,9 +96,21 @@ "cell_type": "code", "execution_count": null, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "theatre\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "for element in words:\n", + " if element.startswith(\"t\"):\n", + " print(element)\n", + " break\n" ] }, { @@ -80,11 +129,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]\n" + ] + } + ], "source": [ - "# your code here" + "nums = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n", + "squares_numbers = []\n", + "for element in nums:\n", + " squares_numbers.append(element**2)\n", + "print(squares_numbers)" ] }, { @@ -96,11 +157,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[1, 3, 5, 7, 9]\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "odd_list = []\n", + "for element in nums:\n", + " if element % 2 != 0:\n", + " odd_list.append(element)\n", + "print(odd_list)\n" ] }, { @@ -112,11 +186,23 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[64, 256, 576, 1024, 1600, 2304, 3136, 4096, 5184, 6400, 7744, 9216, 10816, 12544, 14400, 16384, 18496, 20736, 23104, 25600, 28224, 30976, 33856, 36864, 40000, 43264, 46656, 50176, 53824, 57600, 61504, 65536, 69696, 73984, 78400, 82944, 87616, 92416, 97344, 102400, 107584, 112896, 118336, 123904, 129600, 135424, 141376, 147456, 153664, 160000, 166464, 173056, 179776, 186624, 193600, 200704, 207936, 215296, 222784, 230400, 238144, 246016, 254016, 262144, 270400, 278784, 287296, 295936, 304704, 313600, 322624, 331776, 341056, 350464, 360000, 369664, 379456, 389376, 399424, 409600, 419904, 430336, 440896, 451584, 462400, 473344, 484416, 495616, 506944, 518400, 529984, 541696, 553536, 565504, 577600, 589824, 602176, 614656, 627264, 640000, 652864, 665856, 678976, 692224, 705600, 719104, 732736, 746496, 760384, 774400, 788544, 802816, 817216, 831744, 846400, 861184, 876096, 891136, 906304, 921600, 937024, 952576, 968256, 984064]\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "squares_of_8 = []\n", + "for i in range(8,1000,8):\n", + " squares_of_8.append(i**2)\n", + "print(squares_of_8)\n" ] }, { @@ -128,7 +214,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "metadata": {}, "outputs": [], "source": [ @@ -170,11 +256,20 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "print(len(people))" ] }, { @@ -186,11 +281,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 39, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "4\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "people_kids = 0\n", + "for i in people:\n", + " if i[\"n_kids\"] > 0:\n", + " people_kids += 1\n", + "print(people_kids)\n" ] }, { @@ -202,11 +310,25 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 40, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "10\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "total_kids = 0\n", + "for i in people:\n", + " if i[\"n_kids\"] > 0:\n", + " total_kids += i[\"n_kids\"]\n", + "print(total_kids) \n", + " " ] }, { @@ -218,17 +340,33 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 43, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "[{'name': 'Juan', 'age': 35, 'n_kids': 2}, {'name': 'Pepe', 'age': 28, 'n_kids': 0}, {'name': 'Sonia', 'age': 42, 'n_kids': 2}, {'name': 'LucĂ­a', 'age': 23, 'n_kids': 3}, {'name': 'Leo', 'age': 56, 'n_kids': 5}]\n" + ] + } + ], "source": [ - "# your code here" + "# your code here\n", + "new_people = []\n", + "new_people = people.copy()\n", + "for i in new_people:\n", + " i[\"age\"] += 1\n", + "for i in new_people:\n", + " if i[\"name\"].endswith(\"a\"):\n", + " i[\"n_kids\"] += 1\n", + "print(new_people)\n" ] } ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "base", "language": "python", "name": "python3" }, @@ -242,7 +380,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.13" + "version": "3.13.5" }, "toc": { "base_numbering": 1, @@ -285,11 +423,6 @@ "_Feature" ], "window_display": false - }, - "vscode": { - "interpreter": { - "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49" - } } }, "nbformat": 4,