Skip to content

ComputationalExpression/assignment-queue-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VIPs

Image

Date
13 February 2026 Assigned
20 February 2026 Due
Progress Grade

There exists a waiting line management system that accounts for various organization VIPs and moves them to the front of the line, allowing each member to queue up and proceed according to a number assigned to them. Well, there would be if only it existed.

This is where you come in: you're going to develop such a system using our trusty input button to proceed through member in the line, admitting each when their number and name are called.

The people are impatient, and they need you to let them in!

In short:

  • you will be given a list of people's names and a list of VIPs
  • you need to move the VIPs to the front of the list
  • on each button press, the modified list should print a number (from 1-20) follwed by the name of the associated person
    • the 5 VIPs should come up first every time

Important

In order to run the program in this lab, you'll need to do the following once:

uv run mpremote cp src/Names.py :
uf run mpremote cp src/names.list :

Learning Objectives

This assignment addresses the following course learning objective(s):

  1. Apply Python programming fundamentals to execute and explain computer code that implements interactive, novel solutions to a variety of computable problems.
  2. Implement code consistent with industry-standard practices using professional-grade integrated development environments (IDEs), command-line tools, and version control systems.
  3. Analyze and suggest revisions to existing Python language code to add functionality or repair defects.
  4. Evaluate the practical and ethical implications of writing computer code and discuss the contexts, perceived effects, and impacts exerted on and by computer code as a cultural force or artifact.
  5. Design, describe, and implement original projects incorporating industry-standard practices and Python language fundamentals.

Pinout Diagram

Note

Students may already have this system assembled from a previous lab.

Pinout Diagram

The above graphic is a pinout diagram: a description of how to wire a physical computing project. Match the above diagram with the following components:

  • push button
  • Raspberry Pi Pico
  • 2 wires
  • breadboard

Important

The above writing is critical to the code. We address specific parts during our programs. Make sure it matches. If you have questions, ask a TL or the instructor!

Summary of the problem

Our device must:

  • find VIPs from the VIPs list in the regular list
  • move those VIPs from later positions in the list to earlier positions
  • on each button press, reveal a single name prefixed by their place in line, starting from 1

Additional information

Note

This lab requires use of an additional property of lists: the index of a given value in a list. For example:

numbers = [1, 2, 3]
value = numbers.index(2)

The above gets the index (address) of the value 2 in the list.

Implementing hardware

The hardware (the Raspberry Pi Pico) relies on some fundamental structures:

  • Pins
    • Pin.IN
    • Pin.OUT
  • sleep

For this lab, all we care about is that there is a button and an LED. The following code implements the subsequent topics:

from machine import Pin
from time import sleep

def main():
    btn = Pin(16, Pin.IN, Pin.PULL_UP)
    led = Pin("LED", Pin.OUT)
    while True:
        if btn.value() == 0:
            led.on()
            sleep(.15)
        led.off()
"Debouncing"

Buttons often need a bit of a delay to guarantee that we only capture one press at a time. To do this, we implement "debouncing," a strategy where we sleep our running program for a short, but sufficient, amount of time during which to ignore further button presses.

Pins

Pins represent physical pins on the Raspberry Pi Pico device which can be either inputs or outputs. Our button is an input: Pin(16, Pin.IN); our LED is an on-board output: Pin("LED", Pin.OUT).

As a general rule, 0 indicates a press, and 1 indicates the button is not being pressed.

Code "shape"

Below, you'll find a brief summary of the functional parts of this program. These descriptions are also in the starting file distributed to you.

    """
    control_display: Display queue one by one on press of device button,
    assigning numbers to each name in order of output
    starting at 1, in the format:

        1: NAME

    :param names: Description
    :type names: list
    """

    """
    is_vip: Check if a given name is in the VIP list

    :param name: Description
    :type name: str
    :param vips: Description
    :type vips: list
    :return: Description
    :rtype: bool
    """

    """
    swap_vip: Swap any two members of the list

    :param names: Description
    :type names: list
    :param vip: Description
    :type vip: int
    :param reg: Description
    :type reg: int
    :return: Description
    :rtype: list
    """

Evaluation

Note

To grade this lab, use the uv run gatorgrade command.

Labs in this course are each worth 5 points. You are awarded different levels of points using the following rubric:

Component Value
Programming 2
Code Review 2
Writing 1
Total 5

Programming

Your programming will be evaluated on the following characteristics:

  • Program produces the correct output
  • control_display produces the described behavior
  • is_vip produces the described behavior
  • swap_vip produces the described behavior
  • The summary document contains no TODOs
  • The summary document meets the word count

Expected output

In response to a precise sequence of 3 short presses, 3 long presses, and 3 short presses, the program should output SOS and quit.

Code review

Either a Technical Leader TL or the instructor can perform a code review with you. This must be done before the due date for the assignment. You may accomplish this during a lab session, TL office hours, or during the instructor's office hours. Successful completion of this review (and an accompanying successful outcome) will earn points toward the code review portion of the assignment.

Writing

Students are expected to finish a summary document. This is a Markdown file containing questions. All questions must be answered fully. Typically, this means a word count is assessed.

For this assignment, the minimum required word count is 150.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages