Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mais Aprimoramentos #15

Merged
merged 2 commits into from
Sep 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 33 additions & 28 deletions notebooks/Aula_0_Jupyter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
}
},
"source": [
"Documentação Jupyter Notebook: https://jupyter-notebook.readthedocs.io/en/stable/"
"Documentação Jupyter Notebook: https://jupyter-notebook.readthedocs.io/en/stable/\n",
"\n",
"Lista de Kernels: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels"
]
},
{
Expand Down Expand Up @@ -171,29 +173,31 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Atividade_TADS.ipynb\n",
"Aula_0_Jupyter.ipynb\n",
"Aula_10_Machine_Learning.ipynb\n",
"Aula_11_Regressao_Linear.ipynb\n",
"Aula_12_Regressao_Logistica.ipynb\n",
"Aula_13_Support_Vector_Machines.ipynb\n",
"Aula_14_Arvores_de_Decisao.ipynb\n",
"Aula_15_Florestas_Aleatorias.ipynb\n",
"Aula_16_Analise_de_Componentes_Principais.ipynb\n",
"Aula_17_Clusterizacao.ipynb\n",
"Aula_18_Redes_Neurais_com_TensorFlow.ipynb\n",
"Aula_1_Operadores_Aritmeticos_Relacionais_e_Logicos.ipynb\n",
"Aula_2_Desvio_Condicional_IF.ipynb\n",
"Aula_3_Estruturas_de_Repeticao.ipynb\n",
"Aula_4_Estrutura_de_Dados.ipynb\n",
"Aula_5_Metodos_e_Funcoes.ipynb\n",
"Aula_6_Numpy_Algebra_Linear.ipynb\n",
"Aula_7_pandas.ipynb\n",
"Aula_8_pandas_estatistica.ipynb\n",
"Aula_9_graficos.ipynb\n",
"Aula_Especial_Python.ipynb\n",
"\u001b[1m\u001b[36mdata\u001b[m\u001b[m\n",
"\u001b[1m\u001b[36mimages\u001b[m\u001b[m\n"
"Atividade_TADS.ipynb\r\n",
"Aula_0_Jupyter.ipynb\r\n",
"Aula_10_Machine_Learning.ipynb\r\n",
"Aula_11_Regressao_Linear.ipynb\r\n",
"Aula_12_Regressao_Logistica.ipynb\r\n",
"Aula_13_Support_Vector_Machines.ipynb\r\n",
"Aula_14_Arvores_de_Decisao.ipynb\r\n",
"Aula_15_Florestas_Aleatorias.ipynb\r\n",
"Aula_16_Analise_de_Componentes_Principais.ipynb\r\n",
"Aula_17_Clusterizacao.ipynb\r\n",
"Aula_18_a_Redes_Neurais_com_TensorFlow.ipynb\r\n",
"Aula_18_b_Redes_Neurais_com_PyTorch.ipynb\r\n",
"Aula_1_Operadores_Aritmeticos_Relacionais_e_Logicos.ipynb\r\n",
"Aula_2_Desvio_Condicional_IF.ipynb\r\n",
"Aula_3_Estruturas_de_Repeticao.ipynb\r\n",
"Aula_4_Estrutura_de_Dados.ipynb\r\n",
"Aula_5a_Classes_e_Metodos.ipynb\r\n",
"Aula_5_Funcoes.ipynb\r\n",
"Aula_6_Numpy_Algebra_Linear.ipynb\r\n",
"Aula_7_pandas.ipynb\r\n",
"Aula_8_pandas_estatistica.ipynb\r\n",
"Aula_9_graficos.ipynb\r\n",
"Aula_Especial_Python.ipynb\r\n",
"data\r\n",
"images\r\n"
]
}
],
Expand All @@ -214,7 +218,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"/Users/storopoli/Google Drive/Academic/Disciplinas/Graduação/Ciência de Dados/notebooks\n"
"/home/storopoli/Documents/Python/ciencia-de-dados/notebooks\r\n"
]
}
],
Expand Down Expand Up @@ -252,7 +256,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"67.4 ms ± 417 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
"42.7 ms ± 35 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
Expand All @@ -273,12 +277,13 @@
"name": "stdout",
"output_type": "stream",
"text": [
"67.7 ms ± 710 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
"42.7 ms ± 43.5 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\n"
]
}
],
"source": [
"%%timeit\n",
"y = 5\n",
"x = 3**999999"
]
}
Expand All @@ -300,7 +305,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
"version": "3.9.6"
},
"rise": {
"autolaunch": true,
Expand Down
135 changes: 119 additions & 16 deletions notebooks/Aula_1_Operadores_Aritmeticos_Relacionais_e_Logicos.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
}
},
"source": [
"### Variáveis de Texto (`string`)\n",
"### Variáveis de Texto (`str`)\n",
"\n",
"Qualquer texto é uma `string`"
"Qualquer texto é uma `str`"
]
},
{
Expand Down Expand Up @@ -143,6 +143,74 @@
" ', o seu professor é ' + professor) # usando +"
]
},
{
"cell_type": "markdown",
"metadata": {
"slideshow": {
"slide_type": "subslide"
}
},
"source": [
"### Strings Multi-linhas (_Multi-line strings_)\n",
"\n",
"Se você usar três aspas duplas `\"\"\"` você consegue fazer `str`s multi-linhas:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"A Python I should not advise, —\n",
"It needs a doctor for its eyes,\n",
"And has the measles yearly.\n",
"However, if you feel inclined\n",
"To get one (to improve your mind,\n",
"And not from fashion merely),\n",
"Allow no music near its cage;\n",
"And when it flies into a rage\n",
"Chastise it, most severely.\n",
"I had an Aunt in Yucatan\n",
"Who bought a Python from a man\n",
"And kept it for a pet.\n",
"She died, because she never knew\n",
"These simple little rules and few; —\n",
"The snake is living yet.\n",
"\n"
]
}
],
"source": [
"str_multi = \"\"\"\n",
"A Python I should not advise, —\n",
"It needs a doctor for its eyes,\n",
"And has the measles yearly.\n",
"However, if you feel inclined\n",
"To get one (to improve your mind,\n",
"And not from fashion merely),\n",
"Allow no music near its cage;\n",
"And when it flies into a rage\n",
"Chastise it, most severely.\n",
"I had an Aunt in Yucatan\n",
"Who bought a Python from a man\n",
"And kept it for a pet.\n",
"She died, because she never knew\n",
"These simple little rules and few; —\n",
"The snake is living yet.\n",
"\"\"\"\n",
"\n",
"print(str_multi)"
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -164,7 +232,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 4,
"metadata": {
"slideshow": {
"slide_type": "fragment"
Expand All @@ -188,7 +256,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 5,
"metadata": {
"slideshow": {
"slide_type": "fragment"
Expand All @@ -201,7 +269,7 @@
"'2 + 2 = 4'"
]
},
"execution_count": 4,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -211,6 +279,31 @@
"f\"2 + 2 = {2+2}\""
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"slideshow": {
"slide_type": "fragment"
}
},
"outputs": [
{
"data": {
"text/plain": [
"'Absoluto de -2 - 2 = 4'"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# também funciona para funções\n",
"f\"Absoluto de -2 - 2 = {abs(-2-2)}\""
]
},
{
"cell_type": "markdown",
"metadata": {
Expand All @@ -227,7 +320,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 7,
"metadata": {
"scrolled": true,
"slideshow": {
Expand Down Expand Up @@ -266,7 +359,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 8,
"metadata": {
"slideshow": {
"slide_type": "fragment"
Expand Down Expand Up @@ -295,7 +388,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 9,
"metadata": {
"scrolled": true,
"slideshow": {
Expand All @@ -310,15 +403,15 @@
"dados do aluno\n",
"informe seu nome: Duda\n",
"informe sua idade: 33\n",
"Duda você tem 33 anos!\n"
"Duda, você tem 33 anos!\n"
]
}
],
"source": [
"print(\"dados do aluno\")\n",
"nome = input(\"informe seu nome: \")\n",
"idade = input (\"informe sua idade: \")\n",
"print (nome, \"você tem\", idade, \"anos!\")"
"print(f\"{nome}, você tem {idade} anos!\")"
]
},
{
Expand All @@ -344,7 +437,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 10,
"metadata": {
"scrolled": true,
"slideshow": {
Expand Down Expand Up @@ -404,7 +497,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 11,
"metadata": {
"scrolled": true,
"slideshow": {
Expand Down Expand Up @@ -465,7 +558,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 12,
"metadata": {
"scrolled": true,
"slideshow": {
Expand Down Expand Up @@ -518,14 +611,24 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 13,
"metadata": {
"scrolled": true,
"slideshow": {
"slide_type": "subslide"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"False\n",
"True\n",
"False\n"
]
}
],
"source": [
"x = 1\n",
"y = 3\n",
Expand All @@ -545,7 +648,7 @@
}
},
"source": [
"## Exercícios de fixação"
"## Atividades"
]
},
{
Expand Down