diff --git a/Challenge_01.ipynb b/Challenge_01.ipynb
new file mode 100644
index 0000000..c24e066
--- /dev/null
+++ b/Challenge_01.ipynb
@@ -0,0 +1,81 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "SbLLE9q1eldC"
+ },
+ "source": [
+ "### Challenge 1\n",
+ "\n",
+ "Write a Python program to count the number of occurrences of each word."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "WhtbdwFseldD",
+ "outputId": "369956c7-b9d6-49f3-c362-61d9a350f53b"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "{'pink': 6, 'red': 4, 'eyes': 1, 'orange': 4, 'white': 5, 'black': 5, 'green': 4}\n"
+ ]
+ }
+ ],
+ "source": [
+ "words = [\n",
+ " 'red', 'green', 'black', 'pink', 'black', 'white', 'black', 'eyes',\n",
+ " 'white', 'black', 'orange', 'pink', 'pink', 'red', 'red', 'white', 'orange',\n",
+ " 'white', \"black\", 'pink', 'green', 'green', 'pink', 'green', 'pink',\n",
+ " 'white', 'orange', \"orange\", 'red'\n",
+ "]\n",
+ "\n",
+ "\n",
+ "# Code\n",
+ "\n",
+ "words_set = set(words)\n",
+ "\n",
+ "words_dict = dict()\n",
+ "\n",
+ "for word in words_set:\n",
+ " words_dict[word] = words.count(word)\n",
+ "\n",
+ "print(words_dict)"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 1.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_02.ipynb b/Challenge_02.ipynb
new file mode 100644
index 0000000..3587e4e
--- /dev/null
+++ b/Challenge_02.ipynb
@@ -0,0 +1,96 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "q1NCks7Af6JN"
+ },
+ "source": [
+ "### Challenge 2\n",
+ "\n",
+ "Write a function that takes an integer number of hours and converts that number to seconds.\n",
+ "\n",
+ "Example:\n",
+ "\n",
+ "convert(5) ➞ 18000\n",
+ "\n",
+ "convert(3) ➞ 10800\n",
+ "\n",
+ "convert(2) ➞ 7200"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "id": "sSm6F7sff6JO"
+ },
+ "outputs": [],
+ "source": [
+ "def convert_to_sec(number):\n",
+ " seconds = number * 60 * 60\n",
+ " return seconds"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print(convert_to_sec(5))\n",
+ "print(convert_to_sec(3))\n",
+ "print(convert_to_sec(2))\n",
+ "\n",
+ "print(convert_to_sec(10))\n",
+ "print(convert_to_sec(8))\n",
+ "print(convert_to_sec(1))"
+ ],
+ "metadata": {
+ "id": "-lpAkLKQoFK3",
+ "outputId": "94f7e9e8-86f6-4983-959a-dbed9ebc9cc6",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 6,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "18000\n",
+ "10800\n",
+ "7200\n",
+ "36000\n",
+ "28800\n",
+ "3600\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 2.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_03.ipynb b/Challenge_03.ipynb
new file mode 100644
index 0000000..bab27e5
--- /dev/null
+++ b/Challenge_03.ipynb
@@ -0,0 +1,83 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "9apVxxygf6JR"
+ },
+ "source": [
+ "### Challenge 3\n",
+ "\n",
+ "Write a function that takes a list as input and returns a new ordered list with no duplicate values.\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Code\n",
+ "\n",
+ "def list_order(input_list):\n",
+ " output_list = set(input_list)\n",
+ " output_list = list(output_list)\n",
+ " output_list.sort()\n",
+ " return output_list\n"
+ ],
+ "metadata": {
+ "id": "f8nPzidCWfbu"
+ },
+ "execution_count": 4,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "ndTkQEUBf6JS",
+ "outputId": "8ae5e31a-e350-4359-e24f-9cca512a61b4"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1, 2, 3, 4, 5, 6, 9, 13, 15, 30, 45]\n"
+ ]
+ }
+ ],
+ "source": [
+ "values_list = [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",
+ "print(list_order(values_list))"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 3.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_04.ipynb b/Challenge_04.ipynb
new file mode 100644
index 0000000..8ebf3f6
--- /dev/null
+++ b/Challenge_04.ipynb
@@ -0,0 +1,76 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "dOqcKUYZf6JW"
+ },
+ "source": [
+ "### Challenge 4\n",
+ "\n",
+ "Write a function whose input is a string and the output is another string with the words in reverse order.\n",
+ "\n",
+ "Example:\n",
+ "\n",
+ "text_inverter(\"Python is nice\") ➞ \"nice is Python\""
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "I5TInJDaf6JW",
+ "outputId": "bbf659ca-a6a8-4448-d208-8e5ff4d7ef96"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "order reverse in words the with string another is output the and string a is input whose function a Write\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Code\n",
+ "\n",
+ "def text_inverter(text):\n",
+ " inv = text.split()\n",
+ " inv.reverse()\n",
+ " return ( ' '.join(inv) )\n",
+ "\n",
+ "test = 'Write a function whose input is a string and the output is another string with the words in reverse order'\n",
+ "print( text_inverter(test) )"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 4.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_05.ipynb b/Challenge_05.ipynb
new file mode 100644
index 0000000..5fad726
--- /dev/null
+++ b/Challenge_05.ipynb
@@ -0,0 +1,109 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "gQbaWOWcW1g_"
+ },
+ "source": [
+ "# Challenge 5\n",
+ "\n",
+ "You work in a shoe store and must contact a series of customers. Your phone numbers are listed below. However, it is possible to notice duplicate numbers in the given list. Would you be able to remove these duplicates to prevent customers from being contacted more than once?"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "id": "T68FjcUmWear"
+ },
+ "outputs": [],
+ "source": [
+ "phone_numbers = [\n",
+ "'(765) 368-1506',\n",
+ "'(285) 608-2448',\n",
+ "'(255) 826-9050',\n",
+ "'(554) 994-1517',\n",
+ "'(285) 608-2448',\n",
+ "'(596) 336-5508',\n",
+ "'(511) 821-7870',\n",
+ "'(410) 665-4447',\n",
+ "'(821) 642-8987',\n",
+ "'(285) 608-2448',\n",
+ "'(311) 799-3883',\n",
+ "'(935) 875-2054',\n",
+ "'(464) 788-2397',\n",
+ "'(765) 368-1506',\n",
+ "'(650) 684-1437',\n",
+ "'(812) 816-0881',\n",
+ "'(285) 608-2448',\n",
+ "'(885) 407-1719',\n",
+ "'(943) 769-1061',\n",
+ "'(596) 336-5508',\n",
+ "'(765) 368-1506',\n",
+ "'(255) 826-9050',\n",
+ "]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "F8n1sN-4XrW3",
+ "outputId": "cdf886db-ec17-4ab5-de2b-74b3c97787a6"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "There are 22 numbers on the list.\n",
+ "There are 15 non-duplicate numbers on the list.\n",
+ "['(285) 608-2448', '(511) 821-7870', '(935) 875-2054', '(255) 826-9050', '(464) 788-2397', '(885) 407-1719', '(812) 816-0881', '(596) 336-5508', '(943) 769-1061', '(311) 799-3883', '(765) 368-1506', '(554) 994-1517', '(410) 665-4447', '(821) 642-8987', '(650) 684-1437']\n"
+ ]
+ }
+ ],
+ "source": [
+ "#Code\n",
+ "\n",
+ "print('There are {} numbers on the list.'.format(len(phone_numbers)))\n",
+ "\n",
+ "phone_numbers = set(phone_numbers)\n",
+ "\n",
+ "phone_numbers = list(phone_numbers)\n",
+ "\n",
+ "print('There are {} non-duplicate numbers on the list.'.format(len(phone_numbers)))\n",
+ "\n",
+ "print(phone_numbers)"
+ ]
+ }
+ ],
+ "metadata": {
+ "colab": {
+ "name": "Desafio 5.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_06.ipynb b/Challenge_06.ipynb
new file mode 100644
index 0000000..9aef72a
--- /dev/null
+++ b/Challenge_06.ipynb
@@ -0,0 +1,102 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "AiI1_KNTf6Jh"
+ },
+ "source": [
+ "### Challenge 6\n",
+ "\n",
+ "Create a function that takes two lists and returns a list that contains only the common elements between the lists (no repetition). The function must support different size list.\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "FJD5vNjCI368"
+ },
+ "source": [
+ "**Lists**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "id": "zvaXhmPMI369"
+ },
+ "outputs": [],
+ "source": [
+ "a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n",
+ "b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "id": "mvxpy_vCf6Jh"
+ },
+ "outputs": [],
+ "source": [
+ "# Code\n",
+ "\n",
+ "def list_inner_join(list_a, list_b):\n",
+ " set_a = set(list_a)\n",
+ " set_b = set(list_b)\n",
+ " join = set_a.intersection(list_b)\n",
+ " return list(join)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print(list_inner_join(a, b))"
+ ],
+ "metadata": {
+ "id": "GS-7jhwkK6ar",
+ "outputId": "e955b3be-4b2f-4fad-dca0-98486ef63a0a",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 3,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "[1, 2, 3, 5, 8, 13]\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 6.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_07.ipynb b/Challenge_07.ipynb
similarity index 52%
rename from resolucao_exemplo/Desafio_07.ipynb
rename to Challenge_07.ipynb
index 9c1a57c..04d8848 100644
--- a/resolucao_exemplo/Desafio_07.ipynb
+++ b/Challenge_07.ipynb
@@ -1,48 +1,24 @@
{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "colab": {
- "name": "Desafio 7.ipynb",
- "provenance": [],
- "include_colab_link": true
- },
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3"
- }
- },
"cells": [
{
"cell_type": "markdown",
"metadata": {
- "id": "view-in-github",
- "colab_type": "text"
+ "id": "gQbaWOWcW1g_"
},
"source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "gQbaWOWcW1g_",
- "colab_type": "text"
- },
- "source": [
- "# Desafio 7\n",
- "Um professor de universidade tem uma turma com os seguintes números de telefones:"
+ "# Challenge 7\n",
+ "A university professor has a class with the following phone numbers:"
]
},
{
"cell_type": "code",
+ "execution_count": 2,
"metadata": {
- "id": "T68FjcUmWear",
- "colab_type": "code",
- "colab": {}
+ "id": "T68FjcUmWear"
},
+ "outputs": [],
"source": [
- "telefones_alunos = ['(873) 810-8267', '(633) 244-7325', '(300) 303-5462', \n",
+ "student_phones = ['(873) 810-8267', '(633) 244-7325', '(300) 303-5462', \n",
" '(938) 300-8890', '(429) 264-7427', '(737) 805-2326', \n",
" '(768) 956-8497', '(941) 225-3869', '(203) 606-9463', \n",
" '(294) 430-7720', '(896) 781-5087', '(397) 845-8267', \n",
@@ -56,29 +32,26 @@
" '(374) 361-3844', '(618) 490-4228', '(987) 803-5550', \n",
" '(228) 976-9699', '(757) 450-9985', '(491) 666-5367',\n",
" ]"
- ],
- "execution_count": 0,
- "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:"
+ "He created a WhatsApp group. However, only the following numbers made it into the group."
]
},
{
"cell_type": "code",
+ "execution_count": 3,
"metadata": {
- "id": "0Hxk13ciXZ3h",
- "colab_type": "code",
- "colab": {}
+ "id": "0Hxk13ciXZ3h"
},
+ "outputs": [],
"source": [
- "entraram_no_grupo = ['(596) 685-1242', '(727) 376-5749', '(987) 803-5550', \n",
+ "joined_group = ['(596) 685-1242', '(727) 376-5749', '(987) 803-5550', \n",
" '(633) 244-7325', '(828) 866-0696', '(263) 415-3893', \n",
" '(203) 606-9463', '(296) 415-9944', '(419) 734-4188', \n",
" '(618) 490-4228', '(682) 595-3278', '(938) 300-8890', \n",
@@ -87,61 +60,70 @@
" '(374) 361-3844', '(921) 948-2244', '(807) 554-4076', \n",
" '(822) 640-8496', '(227) 389-3685', '(429) 264-7427', \n",
" '(397) 845-8267']"
- ],
- "execution_count": 0,
- "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?"
+ "Would you be able to create a list of students who have not yet joined the group so that they can be contacted individually?"
]
},
{
"cell_type": "code",
+ "execution_count": 4,
"metadata": {
- "id": "_OSrDQ1noh62",
- "colab_type": "code",
"colab": {
- "base_uri": "https://localhost:8080/",
- "height": 272
+ "base_uri": "https://localhost:8080/"
},
- "outputId": "3e618d51-4d6f-4f4d-ac49-648d95a3f9ec"
+ "id": "_OSrDQ1noh62",
+ "outputId": "4d6afa4c-9eb8-4a22-81fd-70cb89eb449d"
},
- "source": [
- "from pprint import pprint\n",
- "alunos = set(telefones_alunos)\n",
- "alunos_grupo = set(entraram_no_grupo)\n",
- "alunos_fora_grupo = list(alunos.difference(alunos_grupo))\n",
- "pprint(alunos_fora_grupo)"
- ],
- "execution_count": 4,
"outputs": [
{
"output_type": "stream",
+ "name": "stdout",
"text": [
- "['(403) 343-7705',\n",
- " '(873) 810-8267',\n",
- " '(640) 427-2597',\n",
- " '(491) 666-5367',\n",
- " '(300) 303-5462',\n",
- " '(941) 225-3869',\n",
- " '(641) 367-5279',\n",
- " '(856) 338-7094',\n",
- " '(757) 450-9985',\n",
- " '(964) 710-9625',\n",
- " '(797) 649-3653',\n",
- " '(897) 932-2512',\n",
- " '(835) 955-1498',\n",
- " '(294) 430-7720']\n"
- ],
- "name": "stdout"
+ "['(873) 810-8267', '(491) 666-5367', '(300) 303-5462', '(757) 450-9985', '(403) 343-7705', '(964) 710-9625', '(856) 338-7094', '(835) 955-1498', '(640) 427-2597', '(797) 649-3653', '(941) 225-3869', '(294) 430-7720', '(897) 932-2512', '(641) 367-5279']\n"
+ ]
}
+ ],
+ "source": [
+ "# Code\n",
+ "\n",
+ "to_contact = set(student_phones) - set(joined_group)\n",
+ "\n",
+ "to_contact = list(to_contact)\n",
+ "\n",
+ "print(to_contact)"
]
}
- ]
+ ],
+ "metadata": {
+ "colab": {
+ "name": "Desafio 7.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
}
\ No newline at end of file
diff --git a/Challenge_08.ipynb b/Challenge_08.ipynb
new file mode 100644
index 0000000..108ca1a
--- /dev/null
+++ b/Challenge_08.ipynb
@@ -0,0 +1,201 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "o3tkeMDNf6Jo"
+ },
+ "source": [
+ "### Challenge 8\n",
+ "\n",
+ "Write a Python script to find the 10 longest words in a text file.\n",
+ "\n",
+ "The .txt file is located in the same folder as the project (**texto.txt**)."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Importing the .txt file from github\n",
+ "\n",
+ "!curl --remote-name \\\n",
+ " -H 'Accept: application/vnd.github.v3.raw' \\\n",
+ " --location https://raw.githubusercontent.com/antunes-lima/Python-Challenges/master/texto.txt"
+ ],
+ "metadata": {
+ "id": "DRNo009_PCcR",
+ "outputId": "cb383946-9ad5-4fa4-fdcd-ba891a96718d",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 1,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ " % Total % Received % Xferd Average Speed Time Time Time Current\n",
+ " Dload Upload Total Spent Left Speed\n",
+ "100 766 100 766 0 0 4052 0 --:--:-- --:--:-- --:--:-- 4052\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "id": "EknxjSG0f6Jo"
+ },
+ "outputs": [],
+ "source": [
+ "# Code\n",
+ "\n",
+ "text = open('/content/texto.txt', 'r')\n",
+ "\n",
+ "text = text.read()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# removing comma, period, parentheses, question mark\n",
+ "\n",
+ "text = text.replace(',', ' ').replace('.', ' ').replace('(', ' ').replace(')', ' ').replace('?', ' ').replace('-', ' ')\n",
+ "\n",
+ "text = text.split()"
+ ],
+ "metadata": {
+ "id": "VlMtmvKYeSy3"
+ },
+ "execution_count": 3,
+ "outputs": []
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "print(text)"
+ ],
+ "metadata": {
+ "id": "c99mktWbf0DC",
+ "outputId": "e7151e08-35a2-4a42-cd8a-4e912794af64",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 4,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "['What', 'is', 'Python', 'language', 'Python', 'is', 'a', 'widely', 'used', 'high', 'level', 'general', 'purpose', 'interpreted', 'dynamic', 'programming', 'language', 'Its', 'design', 'philosophy', 'emphasizes', 'code', 'readability', 'and', 'its', 'syntax', 'allows', 'programmers', 'to', 'express', 'concepts', 'in', 'fewer', 'lines', 'of', 'code', 'than', 'possible', 'in', 'languages', 'such', 'as', 'C++', 'or', 'Java', 'Python', 'supports', 'multiple', 'programming', 'paradigms', 'including', 'object', 'oriented', 'imperative', 'and', 'functional', 'programming', 'or', 'procedural', 'styles', 'It', 'features', 'a', 'dynamic', 'type', 'system', 'and', 'automatic', 'memory', 'management', 'and', 'has', 'a', 'large', 'and', 'comprehensive', 'standard', 'library', 'The', 'best', 'way', 'we', 'learn', 'anything', 'is', 'by', 'practice', 'and', 'exercise', 'questions', 'We', 'have', 'started', 'this', 'section', 'for', 'those', 'beginner', 'to', 'intermediate', 'who', 'are', 'familiar', 'with', 'Python']\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# creating a dict with words and respective lenght\n",
+ "\n",
+ "words_lenght = dict()\n",
+ "\n",
+ "for word in text:\n",
+ " words_lenght[word] = len(word)\n",
+ "\n",
+ "print(words_lenght)"
+ ],
+ "metadata": {
+ "id": "WGZ0bkmdcU_d",
+ "outputId": "e6bdeb3d-9e24-4b4d-975d-1736ff157820",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 10,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "{'What': 4, 'is': 2, 'Python': 6, 'language': 8, 'a': 1, 'widely': 6, 'used': 4, 'high': 4, 'level': 5, 'general': 7, 'purpose': 7, 'interpreted': 11, 'dynamic': 7, 'programming': 11, 'Its': 3, 'design': 6, 'philosophy': 10, 'emphasizes': 10, 'code': 4, 'readability': 11, 'and': 3, 'its': 3, 'syntax': 6, 'allows': 6, 'programmers': 11, 'to': 2, 'express': 7, 'concepts': 8, 'in': 2, 'fewer': 5, 'lines': 5, 'of': 2, 'than': 4, 'possible': 8, 'languages': 9, 'such': 4, 'as': 2, 'C++': 3, 'or': 2, 'Java': 4, 'supports': 8, 'multiple': 8, 'paradigms': 9, 'including': 9, 'object': 6, 'oriented': 8, 'imperative': 10, 'functional': 10, 'procedural': 10, 'styles': 6, 'It': 2, 'features': 8, 'type': 4, 'system': 6, 'automatic': 9, 'memory': 6, 'management': 10, 'has': 3, 'large': 5, 'comprehensive': 13, 'standard': 8, 'library': 7, 'The': 3, 'best': 4, 'way': 3, 'we': 2, 'learn': 5, 'anything': 8, 'by': 2, 'practice': 8, 'exercise': 8, 'questions': 9, 'We': 2, 'have': 4, 'started': 7, 'this': 4, 'section': 7, 'for': 3, 'those': 5, 'beginner': 8, 'intermediate': 12, 'who': 3, 'are': 3, 'familiar': 8, 'with': 4}\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# getting the 10 longest words\n",
+ "\n",
+ "c = int()\n",
+ "w = str()\n",
+ "longest_words = list()\n",
+ "\n",
+ "# this block repeats until selecting the 10 longest\n",
+ "\n",
+ "while len(longest_words) < 10:\n",
+ "\n",
+ " # this subblock selects the longest word not already selected\n",
+ "\n",
+ " for word in words_lenght:\n",
+ " if word not in longest_words:\n",
+ " if words_lenght[word] > c:\n",
+ " c = words_lenght[word]\n",
+ " w = word\n",
+ " longest_words.append(w)\n",
+ " c = 0\n",
+ " w = ''\n",
+ "\n",
+ "print('Here is a list of the 10 longest words:')\n",
+ "print(longest_words)\n"
+ ],
+ "metadata": {
+ "id": "Zs7kHnP4gi8m",
+ "outputId": "bd9f57e8-869e-49d0-9bca-b72c3e2a74b0",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 15,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Here is a list of the 10 longest words:\n",
+ "['comprehensive', 'intermediate', 'interpreted', 'programming', 'readability', 'programmers', 'philosophy', 'emphasizes', 'imperative', 'functional']\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 8.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_09.ipynb b/Challenge_09.ipynb
new file mode 100644
index 0000000..917e58b
--- /dev/null
+++ b/Challenge_09.ipynb
@@ -0,0 +1,94 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "HpvTpUBGf6Jr"
+ },
+ "source": [
+ "### Challenge 9\n",
+ "\n",
+ "Write a function that returns the sum of multiples of 3 and 5 between 0 and a limit number, which will be used as a parameter. \\\n",
+ "For example, if the limit is 20, it will return the sum of 3, 5, 6, 9, 10, 12, 15, 18, 20."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "id": "a_6aqcKp6wrN"
+ },
+ "outputs": [],
+ "source": [
+ "# Code\n",
+ "\n",
+ "def to_sum(limit):\n",
+ " # selecting the numbers multiple of 3 and 5\n",
+ " to_sum = []\n",
+ " for n in range(limit + 1):\n",
+ " if n % 3 == 0 or n % 5 == 0:\n",
+ " to_sum.append(n)\n",
+ " return sum(to_sum)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "195C6bw-f6Js",
+ "outputId": "3bdc1731-de57-4a83-8838-528dc70f1f50"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "The chosen limit is:\n",
+ "20\n",
+ "The sum of the multiples between 0 and limit is:\n",
+ "98\n"
+ ]
+ }
+ ],
+ "source": [
+ "# chosen limit\n",
+ "limit = 20\n",
+ "\n",
+ "print('The chosen limit is:')\n",
+ "print(limit)\n",
+ "\n",
+ "print('The sum of the multiples between 0 and limit is:')\n",
+ "print(to_sum(limit))"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 9.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_10.ipynb b/Challenge_10.ipynb
new file mode 100644
index 0000000..7c7f03d
--- /dev/null
+++ b/Challenge_10.ipynb
@@ -0,0 +1,147 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "a4-FLDRof6Jv"
+ },
+ "source": [
+ "### Challenge 10\n",
+ "\n",
+ "Given a list, divide it into 3 equal parts and reverse the order of each list.\n",
+ "\n",
+ "**Example:** \n",
+ "\n",
+ "Entry: \\\n",
+ "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n",
+ "\n",
+ "Output: \\\n",
+ "Part 1 [8, 45, 11] \\\n",
+ "Part 2 [12, 14, 23] \\\n",
+ "Part 3 [89, 45, 78] "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 19,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "IJ70pUjnf6Jw",
+ "outputId": "e55ce3db-777b-4e85-efd7-c53bb96770c2"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "List size is equal to 9\n",
+ "Part size is equal to 3\n",
+ "[8, 45, 11]\n",
+ "[12, 14, 23]\n",
+ "[89, 45, 78]\n"
+ ]
+ }
+ ],
+ "source": [
+ "# code\n",
+ "\n",
+ "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n",
+ "\n",
+ "# getting the size of the partitions\n",
+ "\n",
+ "print('List size is equal to {}'.format(len(sampleList)))\n",
+ "n = len(sampleList) // 3\n",
+ "print('Part size is equal to {}'.format(n))\n",
+ "\n",
+ "# partitions of the list\n",
+ "# if lenght is not a multiple of 3, the mid partition will get the rest\n",
+ "# example: if list lenght = 10:\n",
+ "# part 1 and part 3 will be lenght 3, and part 2 will be lenght 4\n",
+ "\n",
+ "part_1 = sampleList[0 : n]\n",
+ "part_1 = list(reversed(part_1))\n",
+ "\n",
+ "part_2 = sampleList[n : ( len(sampleList) - n)]\n",
+ "part_2 = list(reversed(part_2))\n",
+ "\n",
+ "part_3 = sampleList[-n :]\n",
+ "part_3 = list(reversed(part_3))\n",
+ "\n",
+ "print(part_1)\n",
+ "print(part_2)\n",
+ "print(part_3)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 20,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "pNrXNVqf8Wc1",
+ "outputId": "560e022a-068e-430e-8441-f719cfbfa717"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "List size is equal to 14\n",
+ "Part size is equal to 4\n",
+ "[23, 8, 45, 11]\n",
+ "[55, 89, 45, 78, 12, 14]\n",
+ "[56, 41, 53, 19]\n"
+ ]
+ }
+ ],
+ "source": [
+ "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89, 55, 19, 53, 41, 56]\n",
+ "print('List size is equal to {}'.format(len(sampleList)))\n",
+ "n = len(sampleList) // 3\n",
+ "print('Part size is equal to {}'.format(n))\n",
+ "\n",
+ "part_1 = sampleList[0 : n]\n",
+ "part_1 = list(reversed(part_1))\n",
+ "\n",
+ "part_2 = sampleList[n : ( len(sampleList) - n)]\n",
+ "part_2 = list(reversed(part_2))\n",
+ "\n",
+ "part_3 = sampleList[-n :]\n",
+ "part_3 = list(reversed(part_3))\n",
+ "\n",
+ "print(part_1)\n",
+ "print(part_2)\n",
+ "print(part_3)"
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 10.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_11.ipynb b/Challenge_11.ipynb
new file mode 100644
index 0000000..dbc25eb
--- /dev/null
+++ b/Challenge_11.ipynb
@@ -0,0 +1,123 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "y1R0m4oWf6Jz"
+ },
+ "source": [
+ "### Challenge 11\n",
+ "Given a sequence with `n` integers, determine how many numbers in the sequence are even and how many are odd.\\\n",
+ "For example, for the sequence\n",
+ "\n",
+ "`6 2 7 -5 8 -4`\n",
+ "\n",
+ "your function should return the number 4 for the even number and 2 for the odd number.\\\n",
+ "The output should be a **tuple** containing first the even number and then the odd number.\\\n",
+ "For the previous example, the output would be `(4, 2)`."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "id": "pSIzX4zUf6Jz"
+ },
+ "outputs": [],
+ "source": [
+ "# Code\n",
+ "\n",
+ "def count_even_odd(data):\n",
+ " even = 0\n",
+ " odd = 0\n",
+ " for n in data:\n",
+ " if n % 2 == 0:\n",
+ " even += 1\n",
+ " if n % 2 != 0:\n",
+ " odd += 1\n",
+ " output = (even, odd)\n",
+ " return output"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ },
+ "id": "OQG6erslSjri",
+ "outputId": "b248adc4-9bc5-41f6-9dcd-0684acacc515"
+ },
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Even and odd values count is:\n",
+ "(4, 2)\n"
+ ]
+ }
+ ],
+ "source": [
+ "input = [6, 2, 7, -5, 8, -4]\n",
+ "\n",
+ "print ('Even and odd values count is:')\n",
+ "print (count_even_odd(input))"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "input = (1, 4, 8, 5, 9, -1, -5)\n",
+ "\n",
+ "print ('Even and odd values count is:')\n",
+ "print (count_even_odd(input))"
+ ],
+ "metadata": {
+ "id": "wpu0HswYLVFU",
+ "outputId": "23d996b0-a9d9-467e-f2e0-22c6154f62bd",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 4,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "Even and odd values count is:\n",
+ "(2, 5)\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 11.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Challenge_12.ipynb b/Challenge_12.ipynb
new file mode 100644
index 0000000..60194d6
--- /dev/null
+++ b/Challenge_12.ipynb
@@ -0,0 +1,175 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {
+ "id": "AYHY2YXQf6J2"
+ },
+ "source": [
+ "### Challenge 12\n",
+ "\n",
+ "Write a Python function to check the validity of a password.\n",
+ "\n",
+ "The password must have:\n",
+ "\n",
+ "* At least 1 letter between [a-z] and 1 letter between [A-Z].\n",
+ "* At least 1 number between [0-9].\n",
+ "* At least 1 character of [$#@].\n",
+ "* Minimum length of 6 characters.\n",
+ "* Maximum length of 16 characters.\n",
+ "\n",
+ "Entries: \"12345678\", \"J3sus0\", \"#Te5t300\", \"J*90j12374\", \"Michheeul\", \"Monk3y6\"\n",
+ "\n",
+ "The output should be the password and a text indicating whether the password is valid or invalid:\n",
+ "\n",
+ "```\n",
+ "\"1234\" - Invalid password\n",
+ "\"Qw#1234\" - Valid password\n",
+ "```"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "id": "UGgtGYGGf6J3"
+ },
+ "outputs": [],
+ "source": [
+ "# Code\n",
+ "\n",
+ "def password_check(password):\n",
+ " # checking password lenght\n",
+ " valid = 1\n",
+ " if len(password) < 6:\n",
+ " valid = 0\n",
+ " if len(password) > 16:\n",
+ " valid = 0\n",
+ " # checking if at least 1 character meets conditions\n",
+ " # at least 1 lowercase\n",
+ " check = 0\n",
+ " for c in password:\n",
+ " if c.islower() == True:\n",
+ " check = 1\n",
+ " if check == 0:\n",
+ " valid = 0\n",
+ " # at least 1 uppercase\n",
+ " check = 0\n",
+ " for c in password:\n",
+ " if c.isupper() == True:\n",
+ " check = 1\n",
+ " if check == 0:\n",
+ " valid = 0\n",
+ " # at least 1 number\n",
+ " check = 0\n",
+ " for c in password:\n",
+ " if c.isnumeric() == True:\n",
+ " check = 1\n",
+ " if check == 0:\n",
+ " valid = 0\n",
+ " # at least 1 of [$, #, @]\n",
+ " check = 0\n",
+ " for c in password:\n",
+ " if c == '$' or c == '#' or c == '@':\n",
+ " check = 1\n",
+ " if check == 0:\n",
+ " valid = 0\n",
+ " # formatting the output\n",
+ " if valid == 1:\n",
+ " valid = 'Valid'\n",
+ " else:\n",
+ " valid = 'Invalid'\n",
+ " output = str('\"{}\" - {} password'.format(password, valid))\n",
+ " return output"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Testing\n",
+ "# \"1234\" - Invalid password\n",
+ "# \"Qw#1234\" - Valid password\n",
+ "\n",
+ "print(password_check('1234'))\n",
+ "print(password_check('Qw#1234'))"
+ ],
+ "metadata": {
+ "id": "N_A8L3uHQQ0P",
+ "outputId": "1cbd6949-01d1-42f0-e28c-b02055ea2053",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 12,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "\"1234\" - Invalid password\n",
+ "\"Qw#1234\" - Valid password\n"
+ ]
+ }
+ ]
+ },
+ {
+ "cell_type": "code",
+ "source": [
+ "# Testing\n",
+ "\n",
+ "entries = [\"12345678\", \"J3sus0\", \"#Te5t300\", \"J*90j12374\", \"Michheeul\", \"Monk3y6\"]\n",
+ "\n",
+ "for password in entries:\n",
+ " print(password_check(password))"
+ ],
+ "metadata": {
+ "id": "pwvTMhKCODF2",
+ "outputId": "24c1173e-4353-4867-ed6f-74f5d0afb5ec",
+ "colab": {
+ "base_uri": "https://localhost:8080/"
+ }
+ },
+ "execution_count": 10,
+ "outputs": [
+ {
+ "output_type": "stream",
+ "name": "stdout",
+ "text": [
+ "\"12345678\" - Invalid password\n",
+ "\"J3sus0\" - Invalid password\n",
+ "\"#Te5t300\" - Valid password\n",
+ "\"J*90j12374\" - Invalid password\n",
+ "\"Michheeul\" - Invalid password\n",
+ "\"Monk3y6\" - Invalid password\n"
+ ]
+ }
+ ]
+ }
+ ],
+ "metadata": {
+ "anaconda-cloud": {},
+ "colab": {
+ "name": "Desafio 12.ipynb",
+ "provenance": []
+ },
+ "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.7.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}
\ No newline at end of file
diff --git a/Desafio_01.ipynb b/Desafio_01.ipynb
deleted file mode 100644
index db922b9..0000000
--- a/Desafio_01.ipynb
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "SbLLE9q1eldC"
- },
- "source": [
- "### Desafio 1\n",
- "\n",
- "Escreva um programa em Python para contabilizar a quantidade de ocorrências de cada palavra."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "WhtbdwFseldD"
- },
- "outputs": [],
- "source": [
- "palavras = [\n",
- " 'red', 'green', 'black', 'pink', 'black', 'white', 'black', 'eyes',\n",
- " 'white', 'black', 'orange', 'pink', 'pink', 'red', 'red', 'white', 'orange',\n",
- " 'white', \"black\", 'pink', 'green', 'green', 'pink', 'green', 'pink',\n",
- " 'white', 'orange', \"orange\", 'red'\n",
- "]\n",
- "\n",
- "\n",
- "# Seu código"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "M58o1U9KfAxa"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 1.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_02.ipynb b/Desafio_02.ipynb
deleted file mode 100644
index 8aa2264..0000000
--- a/Desafio_02.ipynb
+++ /dev/null
@@ -1,72 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "q1NCks7Af6JN"
- },
- "source": [
- "### Desafio 2\n",
- "\n",
- "Escreva uma função que receba um número inteiro de horas e converta esse número para segundos.\n",
- "\n",
- "Exemplo:\n",
- "\n",
- "convert(5) ➞ 18000\n",
- "\n",
- "convert(3) ➞ 10800\n",
- "\n",
- "convert(2) ➞ 7200"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "sSm6F7sff6JO"
- },
- "outputs": [],
- "source": [
- "def convert_to_sec(number):\n",
- " pass # Seu código"
- ]
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 2.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_03.ipynb b/Desafio_03.ipynb
deleted file mode 100644
index 75be003..0000000
--- a/Desafio_03.ipynb
+++ /dev/null
@@ -1,79 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "9apVxxygf6JR"
- },
- "source": [
- "### Desafio 3\n",
- "\n",
- "Escreva uma função que receba uma lista como entrada e retorne uma nova lista ordenada e sem valores duplicados.\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "ndTkQEUBf6JS"
- },
- "outputs": [],
- "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"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "wo2rA-NriFtO"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 3.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_04.ipynb b/Desafio_04.ipynb
deleted file mode 100644
index bdab516..0000000
--- a/Desafio_04.ipynb
+++ /dev/null
@@ -1,70 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "dOqcKUYZf6JW"
- },
- "source": [
- "### Desafio 4\n",
- "\n",
- "Escreva uma função cuja entrada é uma string e a saída é outra string com as palavras em ordem inversa.\n",
- "\n",
- "Exemplo:\n",
- "\n",
- "inverte_texto(\"Python é legal\") ➞ \"legal é Python\""
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "I5TInJDaf6JW"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 4.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_05.ipynb b/Desafio_05.ipynb
deleted file mode 100644
index 0794a31..0000000
--- a/Desafio_05.ipynb
+++ /dev/null
@@ -1,101 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "gQbaWOWcW1g_"
- },
- "source": [
- "# Desafio 5\n",
- "Você trabalha em uma loja de sapatos e deve contatar uma série de clientes. Seus números de telefone estão na lista abaixo. No entanto, é possível notar números duplicados na lista dada. Você seria capaz de remover estes duplicados para evitar que clientes sejam contatados mais de uma vez?"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "T68FjcUmWear"
- },
- "outputs": [],
- "source": [
- "numeros_telefone = [\n",
- "'(765) 368-1506',\n",
- "'(285) 608-2448',\n",
- "'(255) 826-9050',\n",
- "'(554) 994-1517',\n",
- "'(285) 608-2448',\n",
- "'(596) 336-5508',\n",
- "'(511) 821-7870',\n",
- "'(410) 665-4447',\n",
- "'(821) 642-8987',\n",
- "'(285) 608-2448',\n",
- "'(311) 799-3883',\n",
- "'(935) 875-2054',\n",
- "'(464) 788-2397',\n",
- "'(765) 368-1506',\n",
- "'(650) 684-1437',\n",
- "'(812) 816-0881',\n",
- "'(285) 608-2448',\n",
- "'(885) 407-1719',\n",
- "'(943) 769-1061',\n",
- "'(596) 336-5508',\n",
- "'(765) 368-1506',\n",
- "'(255) 826-9050',\n",
- "]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "F8n1sN-4XrW3"
- },
- "outputs": [],
- "source": [
- "#Seu código"
- ]
- }
- ],
- "metadata": {
- "colab": {
- "authorship_tag": "ABX9TyO0u4amKtoFgAgnb/IGUddy",
- "include_colab_link": true,
- "name": "Desafio 5.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_06.ipynb b/Desafio_06.ipynb
deleted file mode 100644
index 1381088..0000000
--- a/Desafio_06.ipynb
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "AiI1_KNTf6Jh"
- },
- "source": [
- "### Desafio 6\n",
- "\n",
- "Crie uma função que receba duas listas e retorne uma lista que contenha apenas os elementos comuns entre as listas (sem repetição). A função deve suportar lista de tamanhos diferentes.\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {},
- "source": [
- "**Listas**"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": [
- "a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]\n",
- "b = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "mvxpy_vCf6Jh"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "ly-N_Aq624RQ"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 6.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_07.ipynb b/Desafio_07.ipynb
deleted file mode 100644
index 55c90e7..0000000
--- a/Desafio_07.ipynb
+++ /dev/null
@@ -1,132 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "gQbaWOWcW1g_"
- },
- "source": [
- "# Desafio 7\n",
- "Um professor de universidade tem uma turma com os seguintes números de telefones:"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "T68FjcUmWear"
- },
- "outputs": [],
- "source": [
- "telefones_alunos = ['(873) 810-8267', '(633) 244-7325', '(300) 303-5462', \n",
- " '(938) 300-8890', '(429) 264-7427', '(737) 805-2326', \n",
- " '(768) 956-8497', '(941) 225-3869', '(203) 606-9463', \n",
- " '(294) 430-7720', '(896) 781-5087', '(397) 845-8267', \n",
- " '(788) 717-6858', '(419) 734-4188', '(682) 595-3278', \n",
- " '(835) 955-1498', '(296) 415-9944', '(897) 932-2512', \n",
- " '(263) 415-3893', '(822) 640-8496', '(640) 427-2597', \n",
- " '(856) 338-7094', '(807) 554-4076', '(641) 367-5279', \n",
- " '(828) 866-0696', '(727) 376-5749', '(921) 948-2244', \n",
- " '(964) 710-9625', '(596) 685-1242', '(403) 343-7705', \n",
- " '(227) 389-3685', '(264) 372-7298', '(797) 649-3653', \n",
- " '(374) 361-3844', '(618) 490-4228', '(987) 803-5550', \n",
- " '(228) 976-9699', '(757) 450-9985', '(491) 666-5367',\n",
- " ]"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "ryYrStScXgZ3"
- },
- "source": [
- "Ele criou um grupo do WhatsApp. No entanto, somente os seguintes números entraram no grupo."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "0Hxk13ciXZ3h"
- },
- "outputs": [],
- "source": [
- "entraram_no_grupo = ['(596) 685-1242', '(727) 376-5749', '(987) 803-5550', \n",
- " '(633) 244-7325', '(828) 866-0696', '(263) 415-3893', \n",
- " '(203) 606-9463', '(296) 415-9944', '(419) 734-4188', \n",
- " '(618) 490-4228', '(682) 595-3278', '(938) 300-8890', \n",
- " '(264) 372-7298', '(768) 956-8497', '(737) 805-2326', \n",
- " '(788) 717-6858', '(228) 976-9699', '(896) 781-5087',\n",
- " '(374) 361-3844', '(921) 948-2244', '(807) 554-4076', \n",
- " '(822) 640-8496', '(227) 389-3685', '(429) 264-7427', \n",
- " '(397) 845-8267']"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "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?"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "_OSrDQ1noh62"
- },
- "outputs": [],
- "source": [
- "#Seu código."
- ]
- }
- ],
- "metadata": {
- "colab": {
- "authorship_tag": "ABX9TyPinyzdF60Dyi+YfEQiCPfO",
- "include_colab_link": true,
- "name": "Desafio 7.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_08.ipynb b/Desafio_08.ipynb
deleted file mode 100644
index de5d802..0000000
--- a/Desafio_08.ipynb
+++ /dev/null
@@ -1,78 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "o3tkeMDNf6Jo"
- },
- "source": [
- "### Desafio 8\n",
- "\n",
- "Escreva um script Python para encontrar as 10 palavras mais longas em um arquivo de texto.\n",
- "O arquivo .txt está localizado na mesma pasta do projeto (**texto.txt**)."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "EknxjSG0f6Jo"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "ZYbqEWBG5nKx"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 8.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_09.ipynb b/Desafio_09.ipynb
deleted file mode 100644
index 6fb29e1..0000000
--- a/Desafio_09.ipynb
+++ /dev/null
@@ -1,78 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "HpvTpUBGf6Jr"
- },
- "source": [
- "### Desafio 9\n",
- "\n",
- "Escreva uma função que retorne a soma dos múltiplos de 3 e 5 entre 0 e um número limite, que vai ser utilizado como parâmetro. \\\n",
- "Por exemplo, se o limite for 20, ele retornará a soma de 3, 5, 6, 9, 10, 12, 15, 18, 20."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "195C6bw-f6Js"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "a_6aqcKp6wrN"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 9.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_10.ipynb b/Desafio_10.ipynb
deleted file mode 100644
index 4f831f3..0000000
--- a/Desafio_10.ipynb
+++ /dev/null
@@ -1,87 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "a4-FLDRof6Jv"
- },
- "source": [
- "### Desafio 10\n",
- "\n",
- "Dada uma lista, divida-a em 3 partes iguais e reverta a ordem de cada lista.\n",
- "\n",
- "**Exemplo:** \n",
- "\n",
- "Entrada: \\\n",
- "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n",
- "\n",
- "Saída: \\\n",
- "Parte 1 [8, 45, 11] \\\n",
- "Parte 2 [12, 14, 23] \\\n",
- "Parte 3 [89, 45, 78] "
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "IJ70pUjnf6Jw"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "pNrXNVqf8Wc1"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 10.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_11.ipynb b/Desafio_11.ipynb
deleted file mode 100644
index b6a8536..0000000
--- a/Desafio_11.ipynb
+++ /dev/null
@@ -1,85 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "y1R0m4oWf6Jz"
- },
- "source": [
- "### Desafio 8\n",
- "Dados uma sequência com `n` números inteiros, determinar quantos números da sequência são pares e quantos são ímpares.\\\n",
- "Por exemplo, para a sequência\n",
- "\n",
- "`6 2 7 -5 8 -4`\n",
- "\n",
- "a sua função deve retornar o número 4 para o número de pares e 2 para o de ímpares.\\\n",
- "A saída deve ser um **tupla** contendo primeiramente o número de pares e em seguida o número de ímpares.\\\n",
- "Para o exemplo anterior, a saída seria `(4, 2)`."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "pSIzX4zUf6Jz"
- },
- "outputs": [],
- "source": [
- "# Seu código\n",
- "def contar_pares_impares(entrada):\n",
- " pass"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "OQG6erslSjri"
- },
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 11.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/Desafio_12.ipynb b/Desafio_12.ipynb
deleted file mode 100644
index 32aacf3..0000000
--- a/Desafio_12.ipynb
+++ /dev/null
@@ -1,83 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "view-in-github"
- },
- "source": [
- ""
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "colab_type": "text",
- "id": "AYHY2YXQf6J2"
- },
- "source": [
- "### Desafio 12\n",
- "\n",
- "Escreva uma função em Python para verificar a validade de uma senha.\n",
- "\n",
- "A senha deve ter:\n",
- "\n",
- "* Pelo menos 1 letra entre [a-z] e 1 letra entre [A-Z].\n",
- "* Pelo menos 1 número entre [0-9].\n",
- "* Pelo menos 1 caractere de [$ # @].\n",
- "* Comprimento mínimo de 6 caracteres.\n",
- "* Comprimento máximo de 16 caracteres.\n",
- "\n",
- "Entradas: \"12345678\", \"J3sus0\", \"#Te5t300\", \"J*90j12374\", \"Michheeul\", \"Monk3y6\"\n",
- "\n",
- "A saída deve ser a senha e um texto indicando se a senha é válida ou inválida:\n",
- "\n",
- "```\n",
- "\"1234\" - Senha inválida\n",
- "\"Qw#1234\" - Senha válida\n",
- "```"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 0,
- "metadata": {
- "colab": {},
- "colab_type": "code",
- "id": "UGgtGYGGf6J3"
- },
- "outputs": [],
- "source": [
- "# Seu código"
- ]
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "colab": {
- "include_colab_link": true,
- "name": "Desafio 12.ipynb",
- "provenance": []
- },
- "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.7.9"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 1
-}
diff --git a/README.md b/README.md
index 03e65b3..7a6f384 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,2 @@
-# Desafios com Python 3
-Nesta pasta estaremos colocando alguns desafios à serem resolvidos com Python. Abra-os no Jupyter notebook ou Google Colab, resolva-os e nos envie para revisão a partir de um pull request para a pasta da turma.
+# Challenges for Python 3
+On this repository there are some challenges solved with Python. I used Google Colab to solve them, and shared the copy on this folder.
diff --git a/resolucao_exemplo/Desafio_01.ipynb b/resolucao_exemplo/Desafio_01.ipynb
deleted file mode 100644
index 7ec2a9b..0000000
--- a/resolucao_exemplo/Desafio_01.ipynb
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.7.7"
- },
- "colab": {
- "name": "Desafio 1.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "SbLLE9q1eldC",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 1\n",
- "\n",
- "Escreva um programa em Python para contabilizar a quantidade de ocorrências de cada palavra."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "WhtbdwFseldD",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "palavras = [\n",
- " 'red', 'green', 'black', 'pink', 'black', 'white', 'black', 'eyes',\n",
- " 'white', 'black', 'orange', 'pink', 'pink', 'red', 'red', 'white', 'orange',\n",
- " 'white', \"black\", 'pink', 'green', 'green', 'pink', 'green', 'pink',\n",
- " 'white', 'orange', \"orange\", 'red'\n",
- "]"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "M58o1U9KfAxa",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "outputId": "0c55c05a-57c1-4c9f-c11d-032a84b52a4a"
- },
- "source": [
- "contagem = {}\n",
- "for palavra in palavras:\n",
- " total = palavras.count(palavra)\n",
- " contagem[f'{palavra}'] = total\n",
- "print(contagem)"
- ],
- "execution_count": 3,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "{'red': 4, 'green': 4, 'black': 5, 'pink': 6, 'white': 5, 'eyes': 1, 'orange': 4}\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_02.ipynb b/resolucao_exemplo/Desafio_02.ipynb
deleted file mode 100644
index 0bb6113..0000000
--- a/resolucao_exemplo/Desafio_02.ipynb
+++ /dev/null
@@ -1,104 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 2.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "q1NCks7Af6JN",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 2\n",
- "\n",
- "Escreva uma função que recebe um número inteiro de horas e a converte em segundos.\n",
- "\n",
- "Exemplo:\n",
- "\n",
- "convert(5) ➞ 18000\n",
- "\n",
- "convert(3) ➞ 10800\n",
- "\n",
- "convert(2) ➞ 7200"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "sSm6F7sff6JO",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "def convert_to_sec(number):\n",
- " print(number * 3600)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "n1PPfpDl4yce",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 72
- },
- "outputId": "781c863e-201b-48dc-901f-0864f32b8daa"
- },
- "source": [
- "convert_to_sec(5)\n",
- "convert_to_sec(3)\n",
- "convert_to_sec(2)"
- ],
- "execution_count": 2,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "18000\n",
- "10800\n",
- "7200\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_03.ipynb b/resolucao_exemplo/Desafio_03.ipynb
deleted file mode 100644
index 80e7e61..0000000
--- a/resolucao_exemplo/Desafio_03.ipynb
+++ /dev/null
@@ -1,107 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 3.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "9apVxxygf6JR",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 3\n",
- "\n",
- "Escreva uma função que receba uma lista e retorne uma nova lista ordenada e sem valores duplicados.\n"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "ndTkQEUBf6JS",
- "colab_type": "code",
- "colab": {}
- },
- "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]"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "wo2rA-NriFtO",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "def order_list(entrada):\n",
- " lista_final = list(set(entrada))\n",
- " lista_final.sort()\n",
- " print(lista_final)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "TyKqn2fU5_wr",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "outputId": "57004cd3-5d00-47c1-fd6e-96487bb76c19"
- },
- "source": [
- "order_list(lista)"
- ],
- "execution_count": 9,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "[1, 2, 3, 4, 5, 6, 9, 13, 15, 30, 45]\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_04.ipynb b/resolucao_exemplo/Desafio_04.ipynb
deleted file mode 100644
index cb48733..0000000
--- a/resolucao_exemplo/Desafio_04.ipynb
+++ /dev/null
@@ -1,99 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 4.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "dOqcKUYZf6JW",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 4\n",
- "\n",
- "Escreva uma função que receba uma string como parâmetro e retorne outra string com as palavras em ordem inversa.\n",
- "\n",
- "Exemplo:\n",
- "\n",
- "inverte_texto(\"Python é legal\") ➞ \"legal é Python\""
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "I5TInJDaf6JW",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "def inverte_texto(texto):\n",
- " lista = texto.split()\n",
- " lista.reverse()\n",
- " texto_invertido = ' '.join(lista)\n",
- " print(texto_invertido)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "6gq9SLl1xSV1",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "outputId": "24b1f08b-8d98-4438-c1f4-a5a6e0aeff5e"
- },
- "source": [
- "inverte_texto('Python é legal')"
- ],
- "execution_count": 4,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "legal é Python\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_05.ipynb b/resolucao_exemplo/Desafio_05.ipynb
deleted file mode 100644
index 3bfc110..0000000
--- a/resolucao_exemplo/Desafio_05.ipynb
+++ /dev/null
@@ -1,128 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "colab": {
- "name": "Desafio 5.ipynb",
- "provenance": [],
- "include_colab_link": true
- },
- "kernelspec": {
- "name": "python3",
- "display_name": "Python 3"
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "gQbaWOWcW1g_",
- "colab_type": "text"
- },
- "source": [
- "# Desafio 5\n",
- "Você trabalha em uma loja de sapatos e deve contatar uma lista de clientes dada pela seguinte lista de números de telefones:"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "T68FjcUmWear",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "numeros_telefone = [\n",
- "'(765) 368-1506',\n",
- "'(285) 608-2448',\n",
- "'(255) 826-9050',\n",
- "'(554) 994-1517',\n",
- "'(285) 608-2448',\n",
- "'(596) 336-5508',\n",
- "'(511) 821-7870',\n",
- "'(410) 665-4447',\n",
- "'(821) 642-8987',\n",
- "'(285) 608-2448',\n",
- "'(311) 799-3883',\n",
- "'(935) 875-2054',\n",
- "'(464) 788-2397',\n",
- "'(765) 368-1506',\n",
- "'(650) 684-1437',\n",
- "'(812) 816-0881',\n",
- "'(285) 608-2448',\n",
- "'(885) 407-1719',\n",
- "'(943) 769-1061',\n",
- "'(596) 336-5508',\n",
- "'(765) 368-1506',\n",
- "'(255) 826-9050',\n",
- "]"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "ryYrStScXgZ3",
- "colab_type": "text"
- },
- "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?"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "F8n1sN-4XrW3",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 290
- },
- "outputId": "42d799b7-0d8a-43d5-a7bf-470700f3fb25"
- },
- "source": [
- "set(numeros_telefone)"
- ],
- "execution_count": 2,
- "outputs": [
- {
- "output_type": "execute_result",
- "data": {
- "text/plain": [
- "{'(255) 826-9050',\n",
- " '(285) 608-2448',\n",
- " '(311) 799-3883',\n",
- " '(410) 665-4447',\n",
- " '(464) 788-2397',\n",
- " '(511) 821-7870',\n",
- " '(554) 994-1517',\n",
- " '(596) 336-5508',\n",
- " '(650) 684-1437',\n",
- " '(765) 368-1506',\n",
- " '(812) 816-0881',\n",
- " '(821) 642-8987',\n",
- " '(885) 407-1719',\n",
- " '(935) 875-2054',\n",
- " '(943) 769-1061'}"
- ]
- },
- "metadata": {
- "tags": []
- },
- "execution_count": 2
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_06.ipynb b/resolucao_exemplo/Desafio_06.ipynb
deleted file mode 100644
index 00b4b61..0000000
--- a/resolucao_exemplo/Desafio_06.ipynb
+++ /dev/null
@@ -1,101 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 6.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "AiI1_KNTf6Jh",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 6\n",
- "\n",
- "Crie uma função que receba duas listas e retorne uma lista que contenha apenas os elementos comuns entre as listas (sem repetição). A função deve suportar lista de tamanhos diferentes.\n",
- "\n",
- "listas:\n",
- "\n",
- "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]\n"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "mvxpy_vCf6Jh",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "def elementos_comuns(lista1, lista2):\n",
- " set_1 = set(lista1)\n",
- " set_2 = set(lista2)\n",
- " final = list(set_1.intersection(set_2))\n",
- " print(final)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "ly-N_Aq624RQ",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "outputId": "966bdb43-efa8-4ebb-8335-f1fa95b23d41"
- },
- "source": [
- "elementos_comuns([1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13])"
- ],
- "execution_count": 3,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "[1, 2, 3, 5, 8, 13]\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_08.ipynb b/resolucao_exemplo/Desafio_08.ipynb
deleted file mode 100644
index 4156526..0000000
--- a/resolucao_exemplo/Desafio_08.ipynb
+++ /dev/null
@@ -1,84 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "o3tkeMDNf6Jo",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 8\n",
- "\n",
- "Escreva um script Python para encontrar as 10 palavras mais longas em um arquivo.\n",
- "\n",
- "O arquivo TXT está localizado na mesma pasta do projeto (texto.txt)."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "EknxjSG0f6Jo",
- "colab_type": "code",
- "colab": {},
- "tags": []
- },
- "source": [
- "from operator import itemgetter\n",
- "with open('texto.txt', 'r') as f:\n",
- " dic = {} \n",
- " conteudo = f.read().replace('.', ' ').replace('-', ' ').replace(',', ' ').replace(')', ' ')\n",
- " for palavra in conteudo.split():\n",
- " dic[f'{palavra}'] = len(palavra)\n",
- " ordem = sorted(dic.items(), key=itemgetter(1), reverse=True)\n",
- " for k, v in enumerate(ordem):\n",
- " if k < 10:\n",
- " print(v[0], v[1])"
- ],
- "execution_count": 1,
- "outputs": [
- {
- "output_type": "stream",
- "name": "stdout",
- "text": "comprehensive 13\nintermediate 12\ninterpreted 11\nprogramming 11\nreadability 11\nprogrammers 11\nphilosophy 10\nemphasizes 10\nimperative 10\nfunctional 10\n"
- }
- ]
- }
- ],
- "metadata": {
- "anaconda-cloud": {},
- "kernelspec": {
- "display_name": "Python 3.7.7 64-bit ('ML2': conda)",
- "language": "python",
- "name": "python37764bitml2condac5c8214fecce4af0aacfcafaac4bdc1e"
- },
- "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.7.7-final"
- },
- "colab": {
- "name": "Desafio 8.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_09.ipynb b/resolucao_exemplo/Desafio_09.ipynb
deleted file mode 100644
index 83740d3..0000000
--- a/resolucao_exemplo/Desafio_09.ipynb
+++ /dev/null
@@ -1,94 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 9.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "HpvTpUBGf6Jr",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 9\n",
- "\n",
- "Escreva uma função que retorne a soma dos múltiplos de 3 e 5 entre 0 e um número limite (parâmetro). Por exemplo, se o limite for 20, ele retornará a soma de 3, 5, 6, 9, 10, 12, 15, 18, 20."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "195C6bw-f6Js",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "def soma_multiplos(limite):\n",
- " lista = [num for num in range(1, limite + 1) if num % 3 == 0 or num % 5 == 0]\n",
- " soma = sum(lista)\n",
- " print(soma)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "a_6aqcKp6wrN",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 35
- },
- "outputId": "2228f9ec-e0db-40e0-f28e-3f9be3257fd9"
- },
- "source": [
- "soma_multiplos(20)"
- ],
- "execution_count": 2,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "98\n"
- ],
- "name": "stdout"
- }
- ]
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_10.ipynb b/resolucao_exemplo/Desafio_10.ipynb
deleted file mode 100644
index a45e579..0000000
--- a/resolucao_exemplo/Desafio_10.ipynb
+++ /dev/null
@@ -1,124 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 10.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "a4-FLDRof6Jv",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 10\n",
- "\n",
- "Dada uma lista, divida-a em 3 partes iguais e reverta cada lista.\n",
- "\n",
- "Exemplo: \n",
- "\n",
- "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n",
- "\n",
- "Parte 1 [8, 45, 11]\n",
- "\n",
- "Parte 2 [12, 14, 23]\n",
- "\n",
- "Parte 3 [89, 45, 78]"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "IJ70pUjnf6Jw",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 72
- },
- "outputId": "21e3b557-89f7-4492-beb2-600643df0970"
- },
- "source": [
- "sampleList = [11, 45, 8, 23, 14, 12, 78, 45, 89]\n",
- "l1 = []\n",
- "l2 = []\n",
- "l3 = []\n",
- "qtde = len(sampleList) / 3\n",
- "if qtde.is_integer():\n",
- " for elem in sampleList:\n",
- " if len(l1) < qtde:\n",
- " l1.append(elem)\n",
- " parte_1 = reversed(l1)\n",
- " elif len(l2) < qtde:\n",
- " l2.append(elem)\n",
- " parte_2 = reversed(l2)\n",
- " else:\n",
- " if len(l3) < qtde:\n",
- " l3.append(elem)\n",
- " parte_3 = reversed(l3)\n",
- " print(f'Parte 1: {list(parte_1)}'\n",
- " f'\\nParte 2: {list(parte_2)}'\n",
- " f'\\nParte 3: {list(parte_3)}')\n",
- "else:\n",
- " print('A respectiva lista não pode ser dividida em 3 partes iguais!')"
- ],
- "execution_count": 5,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "Parte 1: [8, 45, 11]\n",
- "Parte 2: [12, 14, 23]\n",
- "Parte 3: [89, 45, 78]\n"
- ],
- "name": "stdout"
- }
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "pNrXNVqf8Wc1",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- ""
- ],
- "execution_count": 0,
- "outputs": []
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_11.ipynb b/resolucao_exemplo/Desafio_11.ipynb
deleted file mode 100644
index 695e678..0000000
--- a/resolucao_exemplo/Desafio_11.ipynb
+++ /dev/null
@@ -1,144 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 11.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "y1R0m4oWf6Jz",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 8\n",
- "Dados uma sequência com `n` números inteiros, determinar quantos números da sequência são pares e quantos são ímpares. Por exemplo, para a sequência\n",
- "\n",
- "`6 2 7 -5 8 -4`\n",
- "\n",
- "a sua função deve retornar o número 4 para o número de pares e 2 para o de ímpares. A saída deve ser um tupla contendo primeiramente o número de pares e em seguida o número de ímpares. Para o exemplo anterior, a saída seria `(4, 2)`."
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "pSIzX4zUf6Jz",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "# Seu código\n",
- "def contar_pares_impares(entrada):\n",
- " par = impar = 0\n",
- " lista = []\n",
- " for num in entrada:\n",
- " if num % 2 == 0:\n",
- " par += 1\n",
- " else:\n",
- " impar += 1\n",
- " lista.append(par)\n",
- " lista.append(impar)\n",
- " return tuple(lista)"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "BSuBza0GSjyM",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- ""
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "y_iM2tgF35t7",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "# Não modifique o código abaixo! Vamos testar algumas entradas\n",
- "msg_erro = \"Saída da função para a entrada {} deveria ser {}\"\n",
- "\n",
- "entrada = [6, 2, 7, -5, 8, -4]\n",
- "saida_esperada = (4, 2)\n",
- "assert contar_pares_impares(entrada)==saida_esperada, msg_erro.format(entrada, saida_esperada)\n",
- "\n",
- "entrada = [-3, 2, 7, -5, 8, -4]\n",
- "saida_esperada = (3, 3)\n",
- "assert contar_pares_impares(entrada)==saida_esperada, msg_erro.format(entrada, saida_esperada)\n",
- "\n",
- "\n",
- "# Se nenhuma mensagem for impressa abaixo, significa que a função está implementada corretamente"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "Nfb7lBpq35_6",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- ""
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "UwT4tLtzR3_U",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- ""
- ],
- "execution_count": 0,
- "outputs": []
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/Desafio_12.ipynb b/resolucao_exemplo/Desafio_12.ipynb
deleted file mode 100644
index 7aec280..0000000
--- a/resolucao_exemplo/Desafio_12.ipynb
+++ /dev/null
@@ -1,147 +0,0 @@
-{
- "nbformat": 4,
- "nbformat_minor": 0,
- "metadata": {
- "anaconda-cloud": {},
- "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.6.5"
- },
- "colab": {
- "name": "Desafio 12.ipynb",
- "provenance": [],
- "include_colab_link": true
- }
- },
- "cells": [
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "view-in-github",
- "colab_type": "text"
- },
- "source": [
- "
"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "AYHY2YXQf6J2",
- "colab_type": "text"
- },
- "source": [
- "### Desafio 12\n",
- "\n",
- "Escreva uma função em Python para verificar a validade de uma senha.\n",
- "\n",
- "Validação:\n",
- "\n",
- "* Pelo menos 1 letra entre [a-z] e 1 letra entre [A-Z].\n",
- "* Pelo menos 1 número entre [0-9].\n",
- "* Pelo menos 1 caractere de [$ # @].\n",
- "* Comprimento mínimo de 6 caracteres.\n",
- "* Comprimento máximo de 16 caracteres.\n",
- "\n",
- "Entradas: \"12345678\", \"J3sus0\", \"#Te5t300\", \"J*90j12374\", \"Michheeul\", \"Monk3y6\"\n",
- "\n",
- "A saída deve ser a senha e um texto indicando se a senha é válida ou inválida:\n",
- "\n",
- "```\n",
- "\"1234\" - Senha inválida\n",
- "\"Qw#1234\" - Senha válida\n",
- "```"
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "p8CSSyVNGKiE",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- "lista_senhas = ['12345678',\n",
- " 'J3sus0',\n",
- " '#Te5t300',\n",
- " 'J*90j12374',\n",
- " 'Michheeul',\n",
- " 'Monk3y6',\n",
- " '1234',\n",
- " 'Qw#1234']"
- ],
- "execution_count": 0,
- "outputs": []
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "UGgtGYGGf6J3",
- "colab_type": "code",
- "colab": {
- "base_uri": "https://localhost:8080/",
- "height": 163
- },
- "outputId": "b34b6180-ac74-44e0-8252-43c1da8d2abe"
- },
- "source": [
- "import re\n",
- "def valida_senhas(password):\n",
- " regex = re.compile(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[$#@]).{6,16}$',\n",
- " flags=re.M)\n",
- " resultado = re.findall(regex, password)\n",
- " if resultado:\n",
- " print(f'\"{password}\" - Senha válida')\n",
- " else:\n",
- " print(f'\"{password}\" - Senha inválida')\n",
- "\n",
- "\n",
- "for senha in lista_senhas:\n",
- " valida_senhas(senha)"
- ],
- "execution_count": 2,
- "outputs": [
- {
- "output_type": "stream",
- "text": [
- "\"12345678\" - Senha inválida\n",
- "\"J3sus0\" - Senha inválida\n",
- "\"#Te5t300\" - Senha válida\n",
- "\"J*90j12374\" - Senha inválida\n",
- "\"Michheeul\" - Senha inválida\n",
- "\"Monk3y6\" - Senha inválida\n",
- "\"1234\" - Senha inválida\n",
- "\"Qw#1234\" - Senha válida\n"
- ],
- "name": "stdout"
- }
- ]
- },
- {
- "cell_type": "code",
- "metadata": {
- "id": "n8F01NzD9uHm",
- "colab_type": "code",
- "colab": {}
- },
- "source": [
- ""
- ],
- "execution_count": 0,
- "outputs": []
- }
- ]
-}
\ No newline at end of file
diff --git a/resolucao_exemplo/README.md b/resolucao_exemplo/README.md
deleted file mode 100644
index 3674170..0000000
--- a/resolucao_exemplo/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Resolução da Atividade
-Os arquivos compartilhados a seguir são um exemplo de possível resolução de tal atividade. No entanto, recomendamos que vocês tentem resolver por conta própria pois existem várias formas para se chegar no mesmo resultado (no final, sintam-se à vontade para comparar com as resoluções apresentadas aqui). Agradecimentos especiais ao ex-aluno [Mário Junior](https://github.com/Mario-RJunior) por disponibilizar suas respostas no Github. Para conferir respostas de outros alunos, basta clicar no número à direita de "Fork" e aparecerão todos os alunos que fizeram uma cópia do repositório e postaram suas resoluções. Novamente, recomendamos que vocês olhem elas somente após voce tentar resolver por conta própria :)