{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "c3bec752",
   "metadata": {},
   "source": [
    "# Solução dos exercícios da aula 1\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "dd9c8d19",
   "metadata": {},
   "source": [
    "## Exercício 1\n",
    " Converta as seguintes expressões matemáticas para Python e teste as no interpretador Python"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "43f15fc7",
   "metadata": {},
   "source": [
    " - $10 + 20 \\times 30$\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "id": "84783d88",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "610"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10 + 20 * 30"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f70423b1",
   "metadata": {},
   "source": [
    "<!-- TEASER_END -->"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "5fdea2b2",
   "metadata": {},
   "source": [
    " - $4^2 \\div 30$\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "702c30db",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.5333333333333333"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "4**2 / 30"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e10c0603",
   "metadata": {},
   "source": [
    " - \\\\( (9^4 + 2) \\times 6 - 1 \\\\)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "34009161",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "39377"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(9**4 + 2) * 6 - 1"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c6863712",
   "metadata": {},
   "source": [
    "## Exercício 2\n",
    " Digite a seguinte expressão no interpretador:\n",
    "\n",
    "```python\n",
    "10 % 3 * 10 ** 2 + 1 - 10 * 4 / 2\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "b45a4daf",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "81.0"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10 % 3 * 10 ** 2 + 1 - 10 * 4 / 2\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fb638789",
   "metadata": {},
   "source": [
    "## Exercício 3\n",
    "Faça um programa que escreve o teu nome na tela\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "3de7052f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Meu nome é Paulo Jabardo\n"
     ]
    }
   ],
   "source": [
    "print(\"Meu nome é Paulo Jabardo\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cc5bf180",
   "metadata": {},
   "source": [
    "## Exercício 4\n",
    "Faça um programa que exibe o resultado de \\\\(2a\\times 3b\\\\) onde a vale 3 e b vale 5.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "b691419a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "90\n"
     ]
    }
   ],
   "source": [
    "a = 3\n",
    "b = 5\n",
    "print(2*a * 3*b)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f4e8330c",
   "metadata": {},
   "source": [
    "## Exercício 5\n",
    "Escreva um programa que calcule a soma de três variáveis e imprima o resultado na tela.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "26438319",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "111\n"
     ]
    }
   ],
   "source": [
    "v1 = 1\n",
    "v2 = 10\n",
    "v3 = 100\n",
    "soma = v1 + v2 + v3\n",
    "print(soma)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f8629093",
   "metadata": {},
   "source": [
    "## Exercício 6\n",
    "Modifique o programa 1 de para se calcular o quanto uma pedra cai na lua após 5 s se a aceleração da gravidade na lua vale \\\\(g = 1,625\\:m/s^2\\\\).\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "84a7598a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "20.3125\n"
     ]
    }
   ],
   "source": [
    "t = 5 # s\n",
    "g = 1.625 # m/s**2\n",
    "z = 1/2 * g * t**2   # m\n",
    "print(z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "09dc2574",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = 4\n",
    "b = 10\n",
    "c = 5.0\n",
    "d = 1\n",
    "f = 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "8a1aca1a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a==c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "d73862ec",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a < b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "4f8c4b39",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d > b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "6d3e6ed5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c != f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "9eeae817",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a == b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "89ab5863",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c < d"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "58331331",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c >= f"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "56d1a2da",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "f >= c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "27051e59",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c <= c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "079fc517",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c <= f"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "037b8a1b",
   "metadata": {},
   "source": [
    "## Exercício 8\n",
    "Qual o valo das expressões abaixo para `a = True`, `b = False` e `c = True`?\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "3b976c5e",
   "metadata": {},
   "outputs": [],
   "source": [
    "a = True\n",
    "b = False\n",
    "c = True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "173f82a3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a and b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "6b4dd9c4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b and a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "4318f690",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "8fc13c05",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not b "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "bacb1afe",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "3ed7be25",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a and b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "id": "29466b99",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b and c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "038271b1",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a or c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "id": "20f261d9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b or c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "id": "67613b03",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c or a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "fd70ec93",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c or b"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "be4110ae",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c or c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "d944ec50",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "c"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "id": "a93cf0ef",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "b or b"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "cfe96a11",
   "metadata": {},
   "source": [
    "## Exercício 9\n",
    "Escreva um programa para determinar se uma pessoa deve ou não pagar imposto. Uma pessoa paga imposto se o salário é maior que R$ 1200.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "d1982562",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "True\n"
     ]
    }
   ],
   "source": [
    "salario = 1500\n",
    "deve_pagar = salario > 1200\n",
    "print(deve_pagar)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "id": "7d0e993f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "False\n"
     ]
    }
   ],
   "source": [
    "salario = 1100\n",
    "deve_pagar = salario > 1200\n",
    "print(deve_pagar)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "7dcde761",
   "metadata": {},
   "source": [
    "## Exercício 10\n",
    "Calcule o resultado da expressão para `A > B and C or D`\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "id": "43e71f5b",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = 1; B = 2; C = True; D = False\n",
    "A > B and C or D"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "id": "eb428e57",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = 10; B = 3; C = False; D = False\n",
    "A > B and C or D"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "id": "8ffd6aa3",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "A = 5; B = 1; C = True; D = False\n",
    "A > B and C or D"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "96ee9b63",
   "metadata": {},
   "source": [
    "# Demais exercícios ficam na solução da próxima aula!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "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.9.7"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
