Back to teaching portfolio

Chapter 1 · Computational Thinking

CSBP119 Practical Questions

Kick off Chapter 1 by translating natural language prompts into formal algorithmic steps, then implement the logic in Python. The exercises below are prepped for lab discussion; feel free to remix them for quizzes or demos.

Problem 1 · Volunteers & Intake

Arrival Triage Assistant

Write a short program that reads the number of incoming students and estimates how many volunteers should staff the welcome desk. Use one volunteer per 12 students and always round up.

  1. Prompt for the number of students.
  2. Calculate required volunteers with a ceiling operation.
  3. Print a user-friendly recommendation.
import math

students = int(input("How many students arrived? "))
volunteers = math.ceil(students / 12)
print(f"Assign {volunteers} volunteers to the welcome desk.")
Problem 2 · Capacity Planning

Volunteers + Snack Packs

Extend the arrival helper with a second calculation: determine the number of snack packs by assuming one snack per four students plus a 10% buffer.

  1. Reuse the volunteer helper logic.
  2. Add a function that computes snack packs with the buffer.
  3. Display both recommendations to the console.
import math

def volunteers_needed(students, ratio=12):
    return math.ceil(students / ratio)

def snack_packs(students):
    return math.ceil(students / 4 * 1.10)

people = int(input("Students expected: "))
print("Volunteers:", volunteers_needed(people))
print("Snack packs:", snack_packs(people))
Problem 3 · Checkpoint Prep

Orientation Countdown

Ask for the number of minutes until the next campus tour and display the time as hours plus remaining minutes. Be sure to handle values smaller than 60.

  1. Prompt for a non-negative integer.
  2. Use integer division and modulo to break down the time.
  3. Print a friendly reminder.
minutes_until = int(input("Minutes until the next tour: "))
hours = minutes_until // 60
minutes = minutes_until % 60

print(f"Tours depart in {hours} hour(s) and {minutes} minute(s).")