Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions exercicios/lari_schmillevitch/atividade.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Vou montar a tabuada de 6 começando em 3 e terminando em 8:\n",
"6 X 3 = 18\n",
"6 X 4 = 24\n",
"6 X 5 = 30\n",
"6 X 6 = 36\n",
"6 X 7 = 42\n",
"6 X 8 = 48\n"
]
}
],
"source": [
"# Exercício 36:\n",
"\n",
"numero = int(input(\"Montar a tabuada de: \"))\n",
"inicio = int(input(\"Começar por: \"))\n",
"fim = int(input(\"Terminar em: \"))\n",
"\n",
"if fim >= inicio:\n",
" print(f\"\\nVou montar a tabuada de {numero} começando em {inicio} e terminando em {fim}:\")\n",
"\n",
" for i in range(inicio, fim + 1):\n",
" resultado = numero * i\n",
" print(f\"{numero} X {i} = {resultado}\")\n",
"else:\n",
" print(\"O valor final deve ser maior ou igual ao valor inicial.\")"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"7! = 7 . 6 . 5 . 4 . 3 . 2 . 1 = 5040\n"
]
}
],
"source": [
"# Exercício 32:\n",
"\n",
"numero = int(input(\"Fatorial de: \"))\n",
"\n",
"fatorial = 1 \n",
"contador = numero\n",
"\n",
"while contador > 1:\n",
" fatorial *= contador \n",
" contador -= 1 \n",
"\n",
"sequencia = \"\"\n",
"for i in range(numero, 0, -1):\n",
" if i == 1: \n",
" sequencia += f\"{i}\"\n",
" else:\n",
" sequencia += f\"{i} . \"\n",
"\n",
"representacao = f\"{numero}! = {sequencia} = {fatorial}\"\n",
"\n",
"print(representacao)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"O salário atual do funcionário em 2024 é: R$ 64780166694621041770506486730748940573043905995929564899247622924186706509824.00\n"
]
}
],
"source": [
"# Exercício 38\n",
"\n",
"salario_inicial = float(input(\"Digite o salário inicial do funcionário: \"))\n",
"\n",
"ano_contratacao = 1995\n",
"\n",
"percentual_aumento = 1.5 / 100\n",
"salario_atual = salario_inicial + (salario_inicial * percentual_aumento)\n",
"\n",
"ano_atual = 2024\n",
"ano = 1997\n",
"\n",
"while ano <= ano_atual:\n",
" percentual_aumento *= 2\n",
" salario_atual += salario_atual * percentual_aumento\n",
" ano += 1\n",
"\n",
"print(f\"O salário atual do funcionário em {ano_atual} é: R$ {salario_atual:.2f}\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"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
}