#TeachersCoding: Picking Groups

In my previous post on using OneNote with students, I wrote about the need to choose students to be responsible for each day's notes. This needed to be deliberately planned and fair to students. Here were my requirements:

  • Over the course of a quarter or semester, students had to be picked around the same number of times.
  • I needed groups of two or more students for redundancy.
  • If a student was picked for a given week, there should be some time before being picked again. If repetition of a given student did occur, cycling through the class was a requirement before that student could reappear.

After a while playing around with this, I came up with the code below. Feel free to play with the code. It's embedded in this post through the nifty tools from http://trinket.io..

Here's a walkthrough of the algorithm: fill a list with the student names, and then shuffle the list. Create groups of the desired size until there aren't enough to create a full group. Make a new copy of the student list, shuffle it, and then remove the students that remain from the first list. Finally, tack those remaining students at the beginning of the second list. Repeat until you have the number of groups that you are looking for, and then print out the list.

I can see a number of other applications for something like this. My hope is that you take some time to adapt it to your needs, and then circle back here to share what you used it to do.

2 thoughts on “#TeachersCoding: Picking Groups

  1. Very cool. I wrote a similar program in Python with some added "graphics". My script is a lot messier than yours though (it was my first python program)! https://github.com/shmish/Student-Scrambler

    For my current program, I have to manually edit my class list text file before running my program. I'm always looking for improvements and learning some programming along the way. What I'm working on now, and what you could probably do 10X faster than me if you wanted: moving the script to a web app. I tested out the moving/sorting with javascript and jquery, that went smooth. I'm now learning django so that I can have a db of class lists. I know that you have been using Meteor, this would be a nice step forward for your program. You can load a class into your db and then on any given day you pull up your class in your browser, add/remove students from the student list (using some jquery I think?) and then run the sort.

  2. You've clearly hacked into my to-do list, Doug.

    I'd love to have a draggable system for making this happen. It was something I started mucking around with in Python last year, grumbling that it still wasn't as convenient as having it docked into my Meteor apps with student names already loaded in.

    Stay tuned - thanks for the nudge in the right direction!

Leave a Reply