From 26bc60e1df6b9319ca63b72a32ca56c581c13675 Mon Sep 17 00:00:00 2001 From: Gabrielle Arrache Date: Thu, 27 Jun 2024 23:55:05 -0300 Subject: [PATCH 1/2] =?UTF-8?q?Adicionando=20exerc=C3=ADcios=20da=20semana?= =?UTF-8?q?=204=20do=20curso=20de=20An=C3=A1lise=20de=20Dados=20com=20Pyth?= =?UTF-8?q?on=20da=20Reprograma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gabrielle_arrache/exercicio32.ipynb | 56 +++++++++++++ gabrielle_arrache/exercicio36.ipynb | 67 +++++++++++++++ "gabrielle_arrache/exerc\303\255cio38.ipynb" | 86 ++++++++++++++++++++ 3 files changed, 209 insertions(+) create mode 100644 gabrielle_arrache/exercicio32.ipynb create mode 100644 gabrielle_arrache/exercicio36.ipynb create mode 100644 "gabrielle_arrache/exerc\303\255cio38.ipynb" diff --git a/gabrielle_arrache/exercicio32.ipynb b/gabrielle_arrache/exercicio32.ipynb new file mode 100644 index 0000000..0810a75 --- /dev/null +++ b/gabrielle_arrache/exercicio32.ipynb @@ -0,0 +1,56 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Faça um programa que calcule o fatorial de um número inteiro fornecido pelo usuário. Ex.: 5!=5.4.3.2.1=120." + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "O fatorial de 4 é 24.\n" + ] + } + ], + "source": [ + "numero_usuario = input('Digite um número inteiro no qual você deseja saber o fatorial: ')\n", + "numero = int(numero_usuario)\n", + "resultado = 1\n", + "\n", + "for i in range (numero, 1, -1):\n", + " resultado *= i\n", + "\n", + "print(f'O fatorial de {numero_usuario} é {resultado}.')\n" + ] + } + ], + "metadata": { + "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.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/gabrielle_arrache/exercicio36.ipynb b/gabrielle_arrache/exercicio36.ipynb new file mode 100644 index 0000000..9fb84f0 --- /dev/null +++ b/gabrielle_arrache/exercicio36.ipynb @@ -0,0 +1,67 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Desenvolva um programa que faça a tabuada de um número qualquer inteiro que será digitado pelo usuário, mas a tabuada não deve necessariamente iniciar em 1 e terminar em 10, o valor inicial e final devem ser informados também pelo usuário.\n", + "Obs: Você deve verificar se o usuário não digitou o final menor que o inicial." + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "5 x 7 = 35\n", + "5 x 8 = 40\n", + "5 x 9 = 45\n" + ] + } + ], + "source": [ + "tabuada_usuario = input('Qual tabuada você deseja montar? ')\n", + "tabuada_inicio_usuario = input('Digite o número que você deseja começar: ')\n", + "tabuada_fim_usuario = input('Digite o número que você deseja terminar (até 10): ')\n", + "\n", + "tabuada = int(tabuada_usuario)\n", + "tabuada_inicio = int(tabuada_inicio_usuario)\n", + "tabuada_fim = int(tabuada_fim_usuario)\n", + "resultado = 0\n", + "\n", + "if tabuada_fim >= tabuada_inicio:\n", + " for i in range (tabuada_inicio, tabuada_fim + 1):\n", + " resultado = tabuada * i\n", + " print(f'{tabuada} x {i} = {resultado}')\n", + "\n", + "else:\n", + " print('Digite o número que deseja terminar maior que o número de início da tabuada.')" + ] + } + ], + "metadata": { + "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.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git "a/gabrielle_arrache/exerc\303\255cio38.ipynb" "b/gabrielle_arrache/exerc\303\255cio38.ipynb" new file mode 100644 index 0000000..846982a --- /dev/null +++ "b/gabrielle_arrache/exerc\303\255cio38.ipynb" @@ -0,0 +1,86 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Um funcionário de uma empresa recebe aumento salarial anualmente: Sabe-se que:\n", + "a. Esse funcionário foi contratado em 1995, com salário inicial de R$ 1.000,00;\n", + "b. Em 1996 recebeu aumento de 1,5% sobre seu salário inicial;\n", + "c. A partir de 1997 (inclusive), os aumentos salariais sempre correspondem ao dobro do percentual do ano anterior. \n", + "\n", + "Faça um programa que determine o salário atual desse funcionário. Após concluir isto, altere o programa permitindo que o usuário digite o salário inicial do funcionário." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "salario_inicial = 1000\n", + "aumento_percentual = 0.015\n", + "ano_atual = 2024\n", + "\n", + "salario = salario_inicial * (1 + aumento_percentual)\n", + "print(f'Salário em 1996 é {salario:.2f}')\n", + "\n", + "for i in range (1997, ano_atual + 1):\n", + " aumento_percentual *= 2\n", + " salario *= (1 + aumento_percentual)\n", + "\n", + "print(f'O salário em 2024 é: R$ {salario:.2f}') \n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Após concluir isto, altere o programa permitindo que o usuário digite o salário inicial do funcionário." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "salario_inicial_usuario = input('Digite o salário inicial: ')\n", + "salario_inicial = float(salario_inicial_usuario)\n", + "aumento_percentual = 0.015\n", + "ano_atual = 2024\n", + "\n", + "salario = salario_inicial * (1 + aumento_percentual)\n", + "print(f'Salário em 1996 é R${salario:.2f}')\n", + "\n", + "for i in range (1997, ano_atual + 1):\n", + " aumento_percentual *= 2\n", + " salario *= (1 + aumento_percentual)\n", + " print(f'O salário em {i} é igual a {salario:.2f}')\n", + "\n", + "print(f'Para um salário inicial de R${salario_inicial} O salário em 2024 é: R${salario:.2f}') \n" + ] + } + ], + "metadata": { + "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.12.3" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} From f345136e5b9034b5f66964eefb77e6071dff0de0 Mon Sep 17 00:00:00 2001 From: Gabrielle Arrache Date: Thu, 27 Jun 2024 23:59:11 -0300 Subject: [PATCH 2/2] Limpando cell outputs --- gabrielle_arrache/exercicio32.ipynb | 12 ++---------- gabrielle_arrache/exercicio36.ipynb | 14 ++------------ 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/gabrielle_arrache/exercicio32.ipynb b/gabrielle_arrache/exercicio32.ipynb index 0810a75..c442e71 100644 --- a/gabrielle_arrache/exercicio32.ipynb +++ b/gabrielle_arrache/exercicio32.ipynb @@ -9,17 +9,9 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "O fatorial de 4 é 24.\n" - ] - } - ], + "outputs": [], "source": [ "numero_usuario = input('Digite um número inteiro no qual você deseja saber o fatorial: ')\n", "numero = int(numero_usuario)\n", diff --git a/gabrielle_arrache/exercicio36.ipynb b/gabrielle_arrache/exercicio36.ipynb index 9fb84f0..aac7852 100644 --- a/gabrielle_arrache/exercicio36.ipynb +++ b/gabrielle_arrache/exercicio36.ipynb @@ -10,19 +10,9 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "5 x 7 = 35\n", - "5 x 8 = 40\n", - "5 x 9 = 45\n" - ] - } - ], + "outputs": [], "source": [ "tabuada_usuario = input('Qual tabuada você deseja montar? ')\n", "tabuada_inicio_usuario = input('Digite o número que você deseja começar: ')\n",