Activity 03: Loops, Conditionals, Lists, Dictionaries and Sets
-
Assigned: Friday, 18th September 2026
-
Due and Expiration: Monday, 21st September 2026 by classtime.
Note: the expiration date is the last date you can submit your work for a grade.
- CS101: Data Structures
- Assigned and Due
- Table of contents
- Deliverables
- Project Goals
- Getting Started with UV
- Part 1: Tutorial 1 - The Loop & Conditional Dungeon
- Part 2: Tutorial 2 - The Word Detective Case File
- Part 3: Tutorial 3 - The Pattern Visualizer (Capstone)
- Part 4: Tutorial 4 - The Guild Roster
- Reflection Questions
- Checking Your Work
Note: Parts of this work were enhanced by Claude.
You are to complete and push to your repository the following files:
tutorials/tutorial_01_loops_and_conditionals/dungeon.py- Completed Python source codetutorials/tutorial_02_strings_and_dictionaries/detective.py- Completed Python source codetutorials/tutorial_03_pattern_visualizer/patterns.py- Explored and run (no edits required)tutorials/tutorial_04_sets_and_comprehensions/roster.py- Completed Python source codewriting/reflection.md- Reflection document with answers to all questions
- To practice reading and debugging
for/whileloops andif/elif/elseconditionals. - To practice string manipulation methods and building/looping over dictionaries.
- To connect these fundamentals to real, visual applications (fractals, heatmaps, charts).
- To build confidence fixing "almost-working" code, a core software engineering skill.
- To practice writing sets, list comprehensions, and dictionary comprehensions from scratch.
Tutorials 1 and 2 in this activity only use Python's standard library, so
you can run them directly with python3 -- no extra setup required.
Tutorial 3 adds visualization libraries (matplotlib, plotly, numpy),
so that tutorial uses UV, the same Python package manager from Activity 01,
to install those dependencies in an isolated environment. Tutorial 4 also
uses UV to run its project, but only needs the standard library. If you
haven't installed UV yet, see the
Activity 01 README
or run:
# MacOS (Homebrew)
brew install uv
# MacOS/Linux (curl)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"Verify your installation with:
uv --versionIn this tutorial, you will explore a dungeon full of loops and
conditionals -- each function almost works, but has one small bug for
you to find and fix using the TODO/Hint comments provided.
Location: tutorials/tutorial_01_loops_and_conditionals/
What you will do:
- Read each function's docstring to understand what it should do
- Fix the one bug in each function, guided by the
TODO/Hintcomments - Run the code and confirm your output matches the
# Expected:comments
This tutorial only uses Python's standard library, so no UV project or
extra dependencies are needed -- just run it with python3.
Getting Started:
cd tutorials/tutorial_01_loops_and_conditionals
python3 dungeon.pyIn this tutorial, you will crack a case by cleaning up a suspicious message using string methods and tallying word usage using a dictionary. Each function has one small bug for you to find and fix.
Location: tutorials/tutorial_02_strings_and_dictionaries/
What you will do:
- Fix bugs in string manipulation functions (
.lower(),.replace(),.split(),.strip()) - Fix bugs in dictionary-building and dictionary-reporting functions
- Run the code and confirm your output matches the
# Expected:comments
This tutorial only uses Python's standard library, so no UV project or
extra dependencies are needed -- just run it with python3.
Getting Started:
cd tutorials/tutorial_02_strings_and_dictionaries
python3 detective.pyIn this tutorial, all the code is already complete and correct -- no bugs to fix! Instead, you will run and read code that reuses the loop, conditional, string, and dictionary concepts from Tutorials 1 and 2 to generate a Sierpinski triangle fractal, an interactive prime/even/odd heatmap, and a word-frequency bar chart.
Location: tutorials/tutorial_03_pattern_visualizer/
What you will do:
- Initialize a UV project with required dependencies
- Run the provided code to generate all three visualizations
- Read through the code and connect each visualization back to the loop/conditional/string/dictionary concepts from Tutorials 1 and 2
This tutorial requires matplotlib, plotly, and numpy, so it uses
UV to manage those dependencies in an isolated environment.
Getting Started:
cd tutorials/tutorial_03_pattern_visualizer
uv init
uv add matplotlib plotly numpy
uv run patterns.pyIn this tutorial, you will help organize an adventurer's guild by writing your own sets, list comprehensions, and dictionary comprehensions -- compact tools for building and filtering collections of data.
Location: tutorials/tutorial_04_sets_and_comprehensions/
What you will do:
- Write code for 5 TODOs, guided by the
TODO/Hintcomments - Practice building sets and using set intersection (
&) and difference (-) - Practice writing list comprehensions and dictionary comprehensions
- Run the code and confirm your output matches the
# Expected:comments
This tutorial only uses Python's standard library, so no extra dependencies are needed.
Getting Started:
cd tutorials/tutorial_04_sets_and_comprehensions
uv init
uv run roster.pyAfter completing all three tutorials, answer the reflection questions
in the writing/reflection.md file. These questions will help you
think about debugging, logical operators, string/dictionary
processing, and how these concepts power real visualizations.
To check if your work meets the assignment requirements, you can use GatorGrade:
gatorgrade --config config/gatorgrade.ymlThis will automatically verify:
- All required files exist
- All TODO markers have been removed
- The reflection document is complete
- You have made at least 5 commits to your repository
Note: Make sure to commit your changes regularly throughout the activity using:
git add .
git commit -m "Descriptive message about your changes"
git pushGood luck, and enjoy debugging your way through loops, conditionals, strings, and dictionaries!

