From daec4a62a491b60220b8f370c4bcb56196ea254c Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Thu, 8 Oct 2020 19:34:17 -0300 Subject: [PATCH 01/14] Criado usando o Colaboratory --- Desafio_01.ipynb | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/Desafio_01.ipynb b/Desafio_01.ipynb index 49ee4db..00ff19c 100644 --- a/Desafio_01.ipynb +++ b/Desafio_01.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "SbLLE9q1eldC", - "colab_type": "text" + "id": "SbLLE9q1eldC" }, "source": [ "### Desafio 1\n", @@ -53,8 +52,11 @@ "cell_type": "code", "metadata": { "id": "WhtbdwFseldD", - "colab_type": "code", - "colab": {} + "outputId": "d2820d87-d682-4199-a6e2-b0140be0005a", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } }, "source": [ "palavras = [\n", @@ -65,23 +67,37 @@ "]\n", "\n", "\n", - "# Seu código" + "# Seu código\n", + "word_count={}\n", + "for word in palavras:\n", + " if word in word_count:\n", + " word_count[word] += 1\n", + " else:\n", + " word_count[word] = 1\n", + "\n", + "print(word_count)" ], - "execution_count": 0, - "outputs": [] + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "text": [ + "{'red': 4, 'green': 4, 'black': 5, 'pink': 6, 'white': 5, 'eyes': 1, 'orange': 4}\n" + ], + "name": "stdout" + } + ] }, { "cell_type": "code", "metadata": { - "id": "M58o1U9KfAxa", - "colab_type": "code", - "colab": {} + "id": "M58o1U9KfAxa" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From eef2a0c6c332f277e246ded00d8cb9f54f051d81 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Thu, 8 Oct 2020 19:36:38 -0300 Subject: [PATCH 02/14] Criado usando o Colaboratory --- Desafio_02.ipynb | 61 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/Desafio_02.ipynb b/Desafio_02.ipynb index ee7f64b..ef118a9 100644 --- a/Desafio_02.ipynb +++ b/Desafio_02.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "q1NCks7Af6JN", - "colab_type": "text" + "id": "q1NCks7Af6JN" }, "source": [ "### Desafio 2\n", @@ -60,16 +59,60 @@ { "cell_type": "code", "metadata": { - "id": "sSm6F7sff6JO", - "colab_type": "code", - "colab": {} + "id": "sSm6F7sff6JO" + }, + "source": [ + "def convert_to_sec(number):\n", + " \n", + " pass\n", + " # Seu código" + ], + "execution_count": 2, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "yvo7NBwwWwMJ", + "outputId": "87b6cdc9-e934-4c63-8394-716b6b27dfda", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + } }, "source": [ "def convert_to_sec(number):\n", - " pass # Seu código" + " s=number*3600\n", + " print(s)\n", + " pass\n", + "\n", + "convert_to_sec(5)\n", + "convert_to_sec(3)\n", + "convert_to_sec(2)" + ], + "execution_count": 4, + "outputs": [ + { + "output_type": "stream", + "text": [ + "18000\n", + "10800\n", + "7200\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "2FIkrFDGWo25" + }, + "source": [ + "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From 929869d6dc59cca7c3cc423231d2bdb6b6394c94 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Thu, 8 Oct 2020 20:02:38 -0300 Subject: [PATCH 03/14] Criado usando o Colaboratory --- Desafio_03.ipynb | 43 ++++++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/Desafio_03.ipynb b/Desafio_03.ipynb index 1311cbd..dd1d075 100644 --- a/Desafio_03.ipynb +++ b/Desafio_03.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "9apVxxygf6JR", - "colab_type": "text" + "id": "9apVxxygf6JR" }, "source": [ "### Desafio 3\n", @@ -53,29 +52,47 @@ "cell_type": "code", "metadata": { "id": "ndTkQEUBf6JS", - "colab_type": "code", - "colab": {} + "outputId": "025bfeb3-4a92-494c-c898-8f9056ba9c15", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } }, "source": [ "lista = [1,2,3,4,3,30,3,4,5,6,9,3,2,1,2,4,5,15,6,6,3,13,4,45,5]\n", "\n", - "# Seu código" + "# Seu código\n", + "\n", + "unicos = list(set(lista))\n", + "unicos.sort()\n", + "unicos" ], - "execution_count": 0, - "outputs": [] + "execution_count": 69, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "[1, 2, 3, 4, 5, 6, 9, 13, 15, 30, 45]" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 69 + } + ] }, { "cell_type": "code", "metadata": { - "id": "wo2rA-NriFtO", - "colab_type": "code", - "colab": {} + "id": "wo2rA-NriFtO" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From e74548c776f385c093c7249981683d25a0aa00f9 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Fri, 9 Oct 2020 15:54:51 -0300 Subject: [PATCH 04/14] Criado usando o Colaboratory --- Desafio_04.ipynb | 47 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/Desafio_04.ipynb b/Desafio_04.ipynb index 089c3a8..9376e08 100644 --- a/Desafio_04.ipynb +++ b/Desafio_04.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "dOqcKUYZf6JW", - "colab_type": "text" + "id": "dOqcKUYZf6JW" }, "source": [ "### Desafio 4\n", @@ -56,28 +55,52 @@ { "cell_type": "code", "metadata": { - "id": "I5TInJDaf6JW", - "colab_type": "code", - "colab": {} + "id": "I5TInJDaf6JW" }, "source": [ - "# Seu código" + "# Seu códig\n", + "def inverte_texto(texto): \n", + " lista = texto.split()\n", + " invertido = lista[::-1]\n", + " print(invertido)" ], - "execution_count": 0, + "execution_count": 28, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "6gq9SLl1xSV1", - "colab_type": "code", - "colab": {} + "outputId": "664b2b58-73d6-4589-aaff-40f961d4ddcb", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } + }, + "source": [ + "inverte_texto(\"Python é legal\")" + ], + "execution_count": 31, + "outputs": [ + { + "output_type": "stream", + "text": [ + "['legal', 'é', 'Python']\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "4wEa82cIsEmF" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From 99953e1dbbf3d0e1d35966db4dbbe3d911ed9f1b Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Fri, 9 Oct 2020 16:03:32 -0300 Subject: [PATCH 05/14] Criado usando o Colaboratory --- Desafio_05.ipynb | 65 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 14 deletions(-) diff --git a/Desafio_05.ipynb b/Desafio_05.ipynb index 204b1df..4f572b4 100644 --- a/Desafio_05.ipynb +++ b/Desafio_05.ipynb @@ -5,7 +5,6 @@ "colab": { "name": "Desafio 5.ipynb", "provenance": [], - "authorship_tag": "ABX9TyO0u4amKtoFgAgnb/IGUddy", "include_colab_link": true }, "kernelspec": { @@ -21,14 +20,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "gQbaWOWcW1g_", - "colab_type": "text" + "id": "gQbaWOWcW1g_" }, "source": [ "# Desafio 5\n", @@ -38,9 +36,7 @@ { "cell_type": "code", "metadata": { - "id": "T68FjcUmWear", - "colab_type": "code", - "colab": {} + "id": "T68FjcUmWear" }, "source": [ "numeros_telefone = [\n", @@ -68,14 +64,13 @@ "'(255) 826-9050',\n", "]" ], - "execution_count": 0, + "execution_count": 2, "outputs": [] }, { "cell_type": "markdown", "metadata": { - "id": "ryYrStScXgZ3", - "colab_type": "text" + "id": "ryYrStScXgZ3" }, "source": [ "No entanto, alguns destes números estão duplicados. Você seria capaz de remover estes duplicados para evitar que clientes sejam contatado mais de uma vez?" @@ -85,14 +80,56 @@ "cell_type": "code", "metadata": { "id": "F8n1sN-4XrW3", - "colab_type": "code", - "colab": {} + "outputId": "6792a2ad-db5f-4228-d330-39bbf266f715", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 272 + } + }, + "source": [ + "unicos = list(set(numeros_telefone))\n", + "unicos" + ], + "execution_count": 8, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['(464) 788-2397',\n", + " '(285) 608-2448',\n", + " '(885) 407-1719',\n", + " '(511) 821-7870',\n", + " '(410) 665-4447',\n", + " '(255) 826-9050',\n", + " '(554) 994-1517',\n", + " '(935) 875-2054',\n", + " '(596) 336-5508',\n", + " '(821) 642-8987',\n", + " '(311) 799-3883',\n", + " '(812) 816-0881',\n", + " '(765) 368-1506',\n", + " '(650) 684-1437',\n", + " '(943) 769-1061']" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 8 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "8LE5Cv3ruSBL" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From 7736b4867df82d4a42aab039bf3f2b5079eac4c7 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Fri, 9 Oct 2020 16:13:50 -0300 Subject: [PATCH 06/14] Criado usando o Colaboratory --- Desafio_06.ipynb | 57 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 14 deletions(-) diff --git a/Desafio_06.ipynb b/Desafio_06.ipynb index 4508023..a2e6002 100644 --- a/Desafio_06.ipynb +++ b/Desafio_06.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "AiI1_KNTf6Jh", - "colab_type": "text" + "id": "AiI1_KNTf6Jh" }, "source": [ "### Desafio 6\n", @@ -58,28 +57,58 @@ { "cell_type": "code", "metadata": { - "id": "mvxpy_vCf6Jh", - "colab_type": "code", - "colab": {} + "id": "mvxpy_vCf6Jh" }, "source": [ - "# Seu código" + "# Seu código\n", + "def compare(a,b):\n", + " a = list(set(a))\n", + " b = list(set(b))\n", + " comuns = []\n", + " for i in a:\n", + " if i in b:\n", + " comuns.append(i)\n", + " print(comuns)" ], - "execution_count": 0, + "execution_count": 33, "outputs": [] }, { "cell_type": "code", "metadata": { - "id": "ly-N_Aq624RQ", - "colab_type": "code", - "colab": {} + "id": "ly-N_Aq624RQ" }, "source": [ - "" + "a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n", + "\n", + "b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]" ], - "execution_count": 0, + "execution_count": 34, "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "5_D2qwJnwsc3", + "outputId": "e5abf22a-895f-41a0-e9a2-8b4cc631ece8", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } + }, + "source": [ + "compare(a,b)" + ], + "execution_count": 35, + "outputs": [ + { + "output_type": "stream", + "text": [ + "[1, 2, 3, 5, 8, 13]\n" + ], + "name": "stdout" + } + ] } ] -} +} \ No newline at end of file From afa9b8aff5aaaca02c3b601f24006e81cf618830 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Fri, 9 Oct 2020 16:36:07 -0300 Subject: [PATCH 07/14] Criado usando o Colaboratory --- Desafio_07.ipynb | 88 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 21 deletions(-) diff --git a/Desafio_07.ipynb b/Desafio_07.ipynb index 5107d99..cb1d45f 100644 --- a/Desafio_07.ipynb +++ b/Desafio_07.ipynb @@ -5,7 +5,6 @@ "colab": { "name": "Desafio 7.ipynb", "provenance": [], - "authorship_tag": "ABX9TyPinyzdF60Dyi+YfEQiCPfO", "include_colab_link": true }, "kernelspec": { @@ -21,14 +20,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "gQbaWOWcW1g_", - "colab_type": "text" + "id": "gQbaWOWcW1g_" }, "source": [ "# Desafio 7\n", @@ -38,9 +36,7 @@ { "cell_type": "code", "metadata": { - "id": "T68FjcUmWear", - "colab_type": "code", - "colab": {} + "id": "T68FjcUmWear" }, "source": [ "telefones_alunos = ['(873) 810-8267', '(633) 244-7325', '(300) 303-5462', \n", @@ -58,14 +54,13 @@ " '(228) 976-9699', '(757) 450-9985', '(491) 666-5367',\n", " ]" ], - "execution_count": 0, + "execution_count": 1, "outputs": [] }, { "cell_type": "markdown", "metadata": { - "id": "ryYrStScXgZ3", - "colab_type": "text" + "id": "ryYrStScXgZ3" }, "source": [ "Ele criou um grupo do whatapp no entanto somente os seguintes números entraram:" @@ -74,9 +69,7 @@ { "cell_type": "code", "metadata": { - "id": "0Hxk13ciXZ3h", - "colab_type": "code", - "colab": {} + "id": "0Hxk13ciXZ3h" }, "source": [ "entraram_no_grupo = ['(596) 685-1242', '(727) 376-5749', '(987) 803-5550', \n", @@ -89,14 +82,13 @@ " '(822) 640-8496', '(227) 389-3685', '(429) 264-7427', \n", " '(397) 845-8267']" ], - "execution_count": 0, + "execution_count": 3, "outputs": [] }, { "cell_type": "markdown", "metadata": { - "id": "-inLXlaxoWnC", - "colab_type": "text" + "id": "-inLXlaxoWnC" }, "source": [ "Você seria capaz de criar uma lista dos alunos que ainda não entraram no grupo para que sejam contatados individualmente?" @@ -105,15 +97,69 @@ { "cell_type": "code", "metadata": { - "id": "_OSrDQ1noh62", - "colab_type": "code", - "colab": {} + "id": "_OSrDQ1noh62" + }, + "source": [ + "restantes = telefones_alunos.copy()\n", + "for telefone in telefones_alunos:\n", + " if telefone in entraram_no_grupo:\n", + " restantes.remove(telefone)\n" + ], + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "Si_NTaNUzF_w", + "outputId": "57e38ca0-6b73-4bae-f48d-68d6452988e7", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 255 + } + }, + "source": [ + "restantes" + ], + "execution_count": 9, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "['(873) 810-8267',\n", + " '(300) 303-5462',\n", + " '(941) 225-3869',\n", + " '(294) 430-7720',\n", + " '(835) 955-1498',\n", + " '(897) 932-2512',\n", + " '(640) 427-2597',\n", + " '(856) 338-7094',\n", + " '(641) 367-5279',\n", + " '(964) 710-9625',\n", + " '(403) 343-7705',\n", + " '(797) 649-3653',\n", + " '(757) 450-9985',\n", + " '(491) 666-5367']" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 9 + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "th9GH3B13GeP" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From 65a498fdca1e7a02141f75e805641ee5f53a6375 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sat, 10 Oct 2020 12:58:32 -0300 Subject: [PATCH 08/14] Criado usando o Colaboratory --- Desafio_09.ipynb | 56 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/Desafio_09.ipynb b/Desafio_09.ipynb index 1426b31..a7a4f28 100644 --- a/Desafio_09.ipynb +++ b/Desafio_09.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "HpvTpUBGf6Jr", - "colab_type": "text" + "id": "HpvTpUBGf6Jr" }, "source": [ "### Desafio 9\n", @@ -52,28 +51,61 @@ { "cell_type": "code", "metadata": { - "id": "195C6bw-f6Js", - "colab_type": "code", - "colab": {} + "id": "195C6bw-f6Js" }, "source": [ - "# Seu código" + "# Seu código\n", + "\n", + "def soma_mult(a):\n", + " tres = []\n", + " cinco = []\n", + " for i in range(a+1):\n", + " if i % 3 == 0:\n", + " tres.append(i)\n", + " for i in range(a+1):\n", + " if i % 5 == 0:\n", + " cinco.append(i)\n", + " mult = tres+cinco\n", + " mult = list(set(mult))\n", + " print(sum(mult))\n" ], - "execution_count": 0, + "execution_count": 34, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "a_6aqcKp6wrN", - "colab_type": "code", - "colab": {} + "outputId": "bb7ab15c-bf9b-4795-c3a5-873a4585b0d5", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } + }, + "source": [ + "soma_mult(100)" + ], + "execution_count": 36, + "outputs": [ + { + "output_type": "stream", + "text": [ + "2418\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "eWRnrY7RGjyE" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file From 00bc723acb3b2954b0a3c5accc8939fa78c9baa1 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:01:32 -0300 Subject: [PATCH 09/14] Criado usando o Colaboratory --- Desafio_09.ipynb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Desafio_09.ipynb b/Desafio_09.ipynb index a7a4f28..f7cf2a7 100644 --- a/Desafio_09.ipynb +++ b/Desafio_09.ipynb @@ -76,21 +76,21 @@ "cell_type": "code", "metadata": { "id": "a_6aqcKp6wrN", - "outputId": "bb7ab15c-bf9b-4795-c3a5-873a4585b0d5", + "outputId": "459c586b-cd14-410a-f341-91ffb1946439", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ - "soma_mult(100)" + "soma_mult(20)" ], - "execution_count": 36, + "execution_count": 37, "outputs": [ { "output_type": "stream", "text": [ - "2418\n" + "98\n" ], "name": "stdout" } From ef340cae2246957f6d0cb0fe669c09605c484168 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:39:32 -0300 Subject: [PATCH 10/14] Criado usando o Colaboratory --- Desafio_10.ipynb | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/Desafio_10.ipynb b/Desafio_10.ipynb index 0ed40b5..e9e2f11 100644 --- a/Desafio_10.ipynb +++ b/Desafio_10.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "a4-FLDRof6Jv", - "colab_type": "text" + "id": "a4-FLDRof6Jv" }, "source": [ "### Desafio 10\n", @@ -63,26 +62,48 @@ "cell_type": "code", "metadata": { "id": "IJ70pUjnf6Jw", - "colab_type": "code", - "colab": {} + "outputId": "bcf2d080-c9b0-41b1-88c5-7b51c85b7a2a", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } }, "source": [ - "# Seu código" + "# Seu código\n", + "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n", + "\n", + "split_size = len(sampleList)//3\n", + "split_size\n", + "list1 = sampleList[:split_size]\n", + "list2 = sampleList[split_size:split_size+split_size]\n", + "list3 = sampleList[split_size+split_size:]\n", + "list1[::-1], list2[::-1], list3[::-1]" ], - "execution_count": 0, - "outputs": [] + "execution_count": 36, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "([8, 45, 11], [12, 14, 23], [89, 45, 78])" + ] + }, + "metadata": { + "tags": [] + }, + "execution_count": 36 + } + ] }, { "cell_type": "code", "metadata": { - "id": "pNrXNVqf8Wc1", - "colab_type": "code", - "colab": {} + "id": "pNrXNVqf8Wc1" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] From 325ad3ff40e187e42eacf937baa634ce14d1c13f Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sat, 10 Oct 2020 13:58:53 -0300 Subject: [PATCH 11/14] Criado usando o Colaboratory --- Desafio_10.ipynb | 53 +++++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/Desafio_10.ipynb b/Desafio_10.ipynb index e9e2f11..810fa49 100644 --- a/Desafio_10.ipynb +++ b/Desafio_10.ipynb @@ -61,44 +61,51 @@ { "cell_type": "code", "metadata": { - "id": "IJ70pUjnf6Jw", - "outputId": "bcf2d080-c9b0-41b1-88c5-7b51c85b7a2a", + "id": "IJ70pUjnf6Jw" + }, + "source": [ + "# Seu código\n", + "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n", + "\n", + "def split_reverse(lista):\n", + " split_size = len(lista)//3\n", + " split_size\n", + " list1 = lista[:split_size]\n", + " list2 = lista[split_size:split_size+split_size]\n", + " list3 = lista[split_size+split_size:]\n", + " print(list1[::-1], list2[::-1], list3[::-1])" + ], + "execution_count": 41, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "pNrXNVqf8Wc1", + "outputId": "e321f94b-d3b5-4db3-d39c-bad00a16f516", "colab": { "base_uri": "https://localhost:8080/", "height": 34 } }, "source": [ - "# Seu código\n", - "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n", - "\n", - "split_size = len(sampleList)//3\n", - "split_size\n", - "list1 = sampleList[:split_size]\n", - "list2 = sampleList[split_size:split_size+split_size]\n", - "list3 = sampleList[split_size+split_size:]\n", - "list1[::-1], list2[::-1], list3[::-1]" + "split_reverse(sampleList)" ], - "execution_count": 36, + "execution_count": 42, "outputs": [ { - "output_type": "execute_result", - "data": { - "text/plain": [ - "([8, 45, 11], [12, 14, 23], [89, 45, 78])" - ] - }, - "metadata": { - "tags": [] - }, - "execution_count": 36 + "output_type": "stream", + "text": [ + "[8, 45, 11] [12, 14, 23] [89, 45, 78]\n" + ], + "name": "stdout" } ] }, { "cell_type": "code", "metadata": { - "id": "pNrXNVqf8Wc1" + "id": "xAIWnkESaS6N" }, "source": [ "" From a9915a765d018713ff4f8ff1a7a14573d2ffa44e Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sat, 10 Oct 2020 14:25:15 -0300 Subject: [PATCH 12/14] Criado usando o Colaboratory --- Desafio_11.ipynb | 67 +++++++++++++++--------------------------------- 1 file changed, 21 insertions(+), 46 deletions(-) diff --git a/Desafio_11.ipynb b/Desafio_11.ipynb index aa23e34..7b582e6 100644 --- a/Desafio_11.ipynb +++ b/Desafio_11.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "y1R0m4oWf6Jz", - "colab_type": "text" + "id": "y1R0m4oWf6Jz" }, "source": [ "### Desafio 8\n", @@ -55,50 +54,30 @@ { "cell_type": "code", "metadata": { - "id": "pSIzX4zUf6Jz", - "colab_type": "code", - "colab": {} + "id": "pSIzX4zUf6Jz" }, "source": [ "# Seu código\n", "def contar_pares_impares(entrada):\n", - " pass" - ], - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "metadata": { - "id": "OQG6erslSjri", - "colab_type": "code", - "colab": {} - }, - "source": [ - "" - ], - "execution_count": 0, - "outputs": [] - }, - { - "cell_type": "code", - "metadata": { - "id": "BSuBza0GSjyM", - "colab_type": "code", - "colab": {} - }, - "source": [ - "" + " pares = []\n", + " impar = []\n", + " for i in entrada:\n", + " if i % 2 == 0:\n", + " pares.append(i)\n", + " else:\n", + " impar.append(i)\n", + " p, i = len(pares), len(impar)\n", + "\n", + " return (p,i)\n", + " pass" ], - "execution_count": 0, + "execution_count": 29, "outputs": [] }, { "cell_type": "code", "metadata": { - "id": "y_iM2tgF35t7", - "colab_type": "code", - "colab": {} + "id": "y_iM2tgF35t7" }, "source": [ "# Não modifique o código abaixo! Vamos testar algumas entradas\n", @@ -115,33 +94,29 @@ "\n", "# Se nenhuma mensagem for impressa abaixo, significa que a função está implementada corretamente" ], - "execution_count": 0, + "execution_count": 30, "outputs": [] }, { "cell_type": "code", "metadata": { - "id": "Nfb7lBpq35_6", - "colab_type": "code", - "colab": {} + "id": "Nfb7lBpq35_6" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { - "id": "UwT4tLtzR3_U", - "colab_type": "code", - "colab": {} + "id": "UwT4tLtzR3_U" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] From 81e987a8933aa02ae2178bbfef925d9c8b8a52a4 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Sun, 11 Oct 2020 10:12:23 -0300 Subject: [PATCH 13/14] Criado usando o Colaboratory --- Desafio_12.ipynb | 66 +++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 54 insertions(+), 12 deletions(-) diff --git a/Desafio_12.ipynb b/Desafio_12.ipynb index 0ebd52a..5f0c7f5 100644 --- a/Desafio_12.ipynb +++ b/Desafio_12.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "AYHY2YXQf6J2", - "colab_type": "text" + "id": "AYHY2YXQf6J2" }, "source": [ "### Desafio 12\n", @@ -69,27 +68,70 @@ { "cell_type": "code", "metadata": { - "id": "UGgtGYGGf6J3", - "colab_type": "code", - "colab": {} + "id": "UGgtGYGGf6J3" }, "source": [ - "# Seu código" + "# Seu código\n", + "def valida(senha):\n", + "\n", + " a, b, c, d = -1, -1, -1, -1\n", + "\n", + " if len(senha) < 6 or len(senha) > 16:\n", + " print(\"%s - Senha inválida\" %senha)\n", + "\n", + " else:\n", + " for i in senha:\n", + " if i.isupper() == True:\n", + " a += 1\n", + " if i.islower() == True:\n", + " b += 1\n", + " if i.isnumeric() == True:\n", + " c += 1\n", + " if (i == \"$\" or i == \"#\" or i == \"@\") == True:\n", + " d += 1\n", + "\n", + " if min(a, b, c, d) >= 0:\n", + " print(\"%s - Senha válida\" %senha)\n", + " else:\n", + " print(\"%s - Senha inválida\" %senha)\n", + " " ], - "execution_count": 0, + "execution_count": 53, "outputs": [] }, { "cell_type": "code", "metadata": { - "id": "n8F01NzD9uHm", - "colab_type": "code", - "colab": {} + "id": "p9G-IcvV2CCU", + "outputId": "f91e81c4-6041-4e11-f80f-5cb2a5d88a76", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 34 + } + }, + "source": [ + "valida(\"Michheeul\") " + ], + "execution_count": 54, + "outputs": [ + { + "output_type": "stream", + "text": [ + "Michheeul - Senha inválida\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "7kZyV4WGxW4r" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] From 9323ac2fdd3ab638a1f304d136fdcfbd9b8ca031 Mon Sep 17 00:00:00 2001 From: armandocesar <49970618+armandocesar@users.noreply.github.com> Date: Mon, 12 Oct 2020 13:35:57 -0300 Subject: [PATCH 14/14] Criado usando o Colaboratory --- Desafio_08.ipynb | 134 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 123 insertions(+), 11 deletions(-) diff --git a/Desafio_08.ipynb b/Desafio_08.ipynb index c6fed05..d7a0faf 100644 --- a/Desafio_08.ipynb +++ b/Desafio_08.ipynb @@ -34,14 +34,13 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { "cell_type": "markdown", "metadata": { - "id": "o3tkeMDNf6Jo", - "colab_type": "text" + "id": "o3tkeMDNf6Jo" }, "source": [ "### Desafio 8\n", @@ -54,28 +53,141 @@ { "cell_type": "code", "metadata": { - "id": "EknxjSG0f6Jo", - "colab_type": "code", - "colab": {} + "id": "EknxjSG0f6Jo" }, "source": [ "# Seu código" ], - "execution_count": 0, + "execution_count": null, "outputs": [] }, { "cell_type": "code", "metadata": { "id": "ZYbqEWBG5nKx", - "colab_type": "code", - "colab": {} + "outputId": "f6f8a855-eda0-4108-8210-4b51a8c6dc00", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 68 + } + }, + "source": [ + "!npx degit armandocesar/br-python-challenges -f" + ], + "execution_count": 2, + "outputs": [ + { + "output_type": "stream", + "text": [ + "\u001b[K\u001b[?25hnpx: installed 1 in 2.426s\n", + "\u001b[36m> destination directory is not empty. Using --force, continuing\u001b[39m\n", + "\u001b[36m> cloned \u001b[1marmandocesar/br-python-challenges\u001b[22m#\u001b[1mmaster\u001b[22m\u001b[39m\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "WTXdu29_zC1_" + }, + "source": [ + "arquivo = open(\"texto.txt\", \"rt\")\n", + "texto = arquivo.read()\n", + "lista_texto = list(texto.split())" + ], + "execution_count": 26, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "auF1bPpbuc7i" + }, + "source": [ + "tam = [len(i) for i in lista_texto]" + ], + "execution_count": 39, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "oZmT-53qDc2o" + }, + "source": [ + "merge = [(tam[i], lista_texto[i]) for i in range(len(tam))]" + ], + "execution_count": 41, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "TUz-5WMjqS54" + }, + "source": [ + "u_merge = list(set(merge))" + ], + "execution_count": 61, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "ywvFzucYDlKn" + }, + "source": [ + "sort = sorted(u_merge, reverse=True)" + ], + "execution_count": 62, + "outputs": [] + }, + { + "cell_type": "code", + "metadata": { + "id": "QgNh-KgJnnEs", + "outputId": "b26acf33-8474-4d97-eca3-269d600bedb5", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 187 + } + }, + "source": [ + "for x in range(10):\n", + " print(sort[x])" + ], + "execution_count": 64, + "outputs": [ + { + "output_type": "stream", + "text": [ + "(16, 'object-oriented,')\n", + "(16, 'general-purpose,')\n", + "(13, 'intermediate)')\n", + "(13, 'comprehensive')\n", + "(12, 'readability,')\n", + "(12, 'language.Its')\n", + "(12, 'interpreted,')\n", + "(11, 'programming')\n", + "(11, 'programmers')\n", + "(11, 'library.The')\n" + ], + "name": "stdout" + } + ] + }, + { + "cell_type": "code", + "metadata": { + "id": "mJf3o937pmyc" }, "source": [ "" ], - "execution_count": 0, + "execution_count": null, "outputs": [] } ] -} +} \ No newline at end of file