From 526881080b1cafa6e2ea1de8ac28c773546dc48d Mon Sep 17 00:00:00 2001 From: Carol Dekker <109253089+CarolDekker@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:00:28 -0300 Subject: [PATCH 1/3] refactor: rename files to English snake_case Remove spaces and special characters from file names and update the Colab badge link. --- ...inal_DataVis.ipynb => data_visualization_final_project.ipynb | 2 +- "# Exerc\303\255cio - Quiz.py" => quiz_exercise.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename Trabalho_Final_DataVis.ipynb => data_visualization_final_project.ipynb (99%) rename "# Exerc\303\255cio - Quiz.py" => quiz_exercise.py (100%) diff --git a/Trabalho_Final_DataVis.ipynb b/data_visualization_final_project.ipynb similarity index 99% rename from Trabalho_Final_DataVis.ipynb rename to data_visualization_final_project.ipynb index f5e7955..1e3fed5 100644 --- a/Trabalho_Final_DataVis.ipynb +++ b/data_visualization_final_project.ipynb @@ -24,7 +24,7 @@ "colab_type": "text" }, "source": [ - "\"Open" + "\"Open" ] }, { diff --git "a/# Exerc\303\255cio - Quiz.py" b/quiz_exercise.py similarity index 100% rename from "# Exerc\303\255cio - Quiz.py" rename to quiz_exercise.py From 35d780ca014120124e51e82476bbc2cd1612aa3b Mon Sep 17 00:00:00 2001 From: Carol Dekker <109253089+CarolDekker@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:00:53 -0300 Subject: [PATCH 2/3] fix(quiz): validate option range and translate to English The range check used 'and', so it could never be true. Use 'or' and derive the limit from the number of options. --- quiz_exercise.py | 72 ++++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/quiz_exercise.py b/quiz_exercise.py index db230dd..90f6bee 100644 --- a/quiz_exercise.py +++ b/quiz_exercise.py @@ -1,47 +1,47 @@ -# Exercício - sistema de perguntas e respostas -# Objetivo: Atividade utilizando dicionario +# Quiz exercise: multiple-choice questions stored in a list of dictionaries. +# Goal: practice dictionaries, lists, enumerate() and input validation. - -perguntas = [ +questions = [ { - 'Pergunta': 'Quanto é 2+2?', - 'Opções': ['1', '3', '4', '5'], - 'Resposta': '4', + "question": "What is 2 + 2?", + "options": ["1", "3", "4", "5"], + "answer": "4", }, { - 'Pergunta': 'Quanto é 5*5?', - 'Opções': ['25', '55', '10', '51'], - 'Resposta': '25', + "question": "What is 5 * 5?", + "options": ["25", "55", "10", "51"], + "answer": "25", }, { - 'Pergunta': 'Quanto é 10/2?', - 'Opções': ['4', '5', '2', '1'], - 'Resposta': '5', + "question": "What is 10 / 2?", + "options": ["4", "5", "2", "1"], + "answer": "5", }, ] -certas = 0 -for item in perguntas: - print(item['Pergunta']) - for posicao, opcao in enumerate(item['Opções']): #enumerate permite adicionar numeros posicionais - print(f'{posicao}) {opcao}') - if opcao == item['Resposta']: - pos_certa = posicao - - resposta = input("Escolha uma opção: ") - - if resposta.isdigit(): - r = int(resposta) - if r > len(item['Opções']) and r <=0: - print("APENAS OPÇÕES 0 À 3!!!") - else: - if r == pos_certa: - certas = certas + 1 - print("CERTA RESPOSTA!!") - else: - print("ERROOOUU") - else: - print("APENAS NÚMEROS!") +correct = 0 +for item in questions: + print(item["question"]) + # enumerate() returns (position, value) pairs + for position, option in enumerate(item["options"]): + print(f"{position}) {option}") + if option == item["answer"]: + correct_position = position + + reply = input("Choose an option: ") + + if not reply.isdigit(): + print("Numbers only!") break -print (f'TOTAL: {certas}/3') + choice = int(reply) + last_option = len(item["options"]) - 1 + if choice < 0 or choice > last_option: + print(f"Only options 0 to {last_option}!") + elif choice == correct_position: + correct += 1 + print("Correct!") + else: + print("Wrong answer.") + +print(f"TOTAL: {correct}/{len(questions)}") From c35ebe028369fabd5fbcfd20f3f901f8f56107ef Mon Sep 17 00:00:00 2001 From: Carol Dekker <109253089+CarolDekker@users.noreply.github.com> Date: Wed, 2 Dec 2026 12:00:53 -0300 Subject: [PATCH 3/3] docs: add bilingual README and .gitignore --- .gitignore | 5 +++++ README.md | 18 ++++++++++++++++++ README.pt-BR.md | 18 ++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 README.pt-BR.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..27bc291 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +__pycache__/ +*.pyc +.ipynb_checkpoints/ +.venv/ +.env diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1b24a3 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +# Python Studies + +[Português](README.pt-BR.md) + +Small Python exercises from my undergraduate studies in Information and Communication Technology (UFSC). + +| File | What it is | Concepts | +|---|---|---| +| [`quiz_exercise.py`](quiz_exercise.py) | Command-line multiple-choice quiz | lists of dictionaries, `enumerate()`, input validation | +| [`data_visualization_final_project.ipynb`](data_visualization_final_project.ipynb) | Data Visualization course final project: exploratory analysis of international tourist arrivals in Brazil (2019) | pandas, seaborn, matplotlib, folium heat maps, geocoding with geopy | + +## Running + +```bash +python quiz_exercise.py +``` + +The notebook was written for Google Colab: use the **Open in Colab** badge at its top. It reads CSV files from a Google Drive folder, so update the paths to your own copy of the datasets. diff --git a/README.pt-BR.md b/README.pt-BR.md new file mode 100644 index 0000000..7d6c4ec --- /dev/null +++ b/README.pt-BR.md @@ -0,0 +1,18 @@ +# Estudos de Python + +[English](README.md) + +Exercícios de Python da graduação em Tecnologias da Informação e Comunicação (UFSC). + +| Arquivo | O que é | Conceitos | +|---|---|---| +| [`quiz_exercise.py`](quiz_exercise.py) | Quiz de múltipla escolha no terminal | listas de dicionários, `enumerate()`, validação de entrada | +| [`data_visualization_final_project.ipynb`](data_visualization_final_project.ipynb) | Trabalho final da disciplina de Visualização de Dados: análise exploratória das chegadas de turistas internacionais ao Brasil (2019) | pandas, seaborn, matplotlib, mapas de calor com folium, geocodificação com geopy | + +## Como rodar + +```bash +python quiz_exercise.py +``` + +O notebook foi feito para o Google Colab: use o botão **Open in Colab** no topo dele. Ele lê arquivos CSV de uma pasta do Google Drive, então ajuste os caminhos para a sua cópia dos dados.