Homework Hacks

Must complete at least 1 Random Algorithms Homework Hack and then the 1 Simulations Homework Hack. By doing 2/3 Hacks, you’ll be graded on a scale of .9. By doing 3/3 Hacks, you’ll be graded on a scale of .95.


Random Algorithms

Homework Hack 1: Random Team Assignment

Objective: Randomly assign students to teams for a group project.

Task:

  • You are given a list of 15 students.
  • The goal is to randomly assign each student to one of 3 teams (be creative with the names)
  • Implement the random assignment:
  • Randomly assign each student to a team
  • Print out the list of students and their assigned teams.

Hack 2: Random Weather

Objective: Generate random weather patterns over a set number of days.

Task:

  • You’re simulating the weather for a 7-day forecast.
  • The weather each day can be one of three options: Sunny, Cloudy, or Rainy.
  • Write a program randomly selecting the weather type for each of the 7 days.
  • Print the weather for each day

Simulations

Homework Hack: Simulate a Random Coffee Shop Queue

Objective: Simulate a random coffee shop queue and determine how long it takes for customers to get served.

Task: Simulate a coffee shop with 5 customers. Each customer has a random service time (between 1 and 5 minutes). The coffee shop serves customers in the order they arrive. Calculate and print the total time it takes for all 5 customers to be served.


Homework Submission + MCQ