diff --git a/python-debug-lab-20260129/debug_exercise_01.ipynb b/python-debug-lab-20260129/debug_exercise_01.ipynb index 5f18677..9989fe3 100644 --- a/python-debug-lab-20260129/debug_exercise_01.ipynb +++ b/python-debug-lab-20260129/debug_exercise_01.ipynb @@ -1,39 +1,109 @@ { - "nbformat": 4, - "nbformat_minor": 0, - "metadata": { - "colab": { - "provenance": [] + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "l94GSb7b5_B1" + }, + "source": [ + "## Este programa pergunta dados do utilizador." + ] }, - "kernelspec": { - "name": "python3", - "display_name": "Python 3" + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "JAxCEAYjWUfd", + "outputId": "cc9c74dc-a603-4d1f-83a0-84f67439a8ec" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Qual é o teu nome? Nuno Rocha\n", + "Qual é a tua idade? 55\n", + "Qual é o teu peso em kg? 77.50\n", + "\n", + "\n", + "Olá Nuno Rocha\n", + "Tens 55 anos \n", + "Pesas 77.5 kg\n" + ] + } + ], + "source": [ + "nome = input(\"Qual é o teu nome? \")\n", + "idade = int(input(\"Qual é a tua idade? \"))\n", + "peso = float(input(\"Qual é o teu peso em kg? \"))\n", + "print(\"\\n\")\n", + "print(f\"Olá {nome}\")\n", + "print(f\"Tens {idade} anos \")\n", + "print(f\"Pesas {peso} kg\")" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "id": "Ae1jOWeW5_B3" + }, + "source": [ + "## Converter todos os prints para f-string" + ] }, - "language_info": { - "name": "python" - } - }, - "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "metadata": { - "id": "JAxCEAYjWUfd" + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "Cb_LKzXi5_B3", + "outputId": "2cf5dd18-06ea-4c81-eb67-5b818e39075b" }, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Olá Nuno Rocha, tens 55 anos e pesas 77.5kg\n", + "\n", + "\n", + "Programa terminado\n" + ] + } + ], "source": [ - "Este programa pergunta dados do utilizador.\n", - "\n", - "nome = input(\"Qual é o teu nome?\")\n", - "idade = input(\"Qual é a tua idade?\")\n", - "peso = input(\"Qual é o teu peso em kg?\")\n", - "\n", - "print(\"Olá \" + nome # Converter todos os prints para f-string\n", - "print(\"Tens \" + idade + \" anos \")\n", - "print(\"Pesas \" + peso + \" kg\")\n", - "\n", - "pritn(\"Programa terminado\")" + "print(f\"Olá {nome}, tens {idade} anos e pesas {peso}kg\")\n", + "print(\"\\n\")\n", + "print(\"Programa terminado\")" ] } - ] -} \ No newline at end of file + ], + "metadata": { + "colab": { + "provenance": [] + }, + "kernelspec": { + "display_name": "Python 3", + "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.13.12" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +}