Progress on Python-Powered randomized quiz generator

One of the projects floating around in my head since the end of last year is creating an easy to use tool that will automatically generate questions for students to test their skills either on their own or while in class. My first attempt at this was during a unit in Geometry on translations, my first attempt at implementing standards based grading. I was taking a Udacity course on web applications and realized that if I could write a quiz generator online, it would be the easiest way to give students a sense of how they were doing without needing me to be part of the process.

As most people doing reassessments tend to be, I was a bit overwhelmed with the paperwork side of things, especially because many of the students just wanted to know if they were right or not. I had made some Python programs to generate quiz questions one by one and decided to try to adapt it to the web application so students could input their answers to questions that had different numbers every time. I had tried to use other options such as PollEverywhere, Socrative to at least collect the data and check it as right/wrong (which would have been good enough for a start in terms of collecting data, but left out the randomization part). The problem with these is that I believe they are hosted in the US and are incredibly slow without a VPN. I needed a solution that was fast, and if I could add the randomization, that would be even better. I decided to try to adapt my quiz generator to a Google App Engine hosted web application.

Needless to say (at least for me) this was not an easy task. I had a loose understanding of how to manage GET and POST requests and use cookies to store random values used. The biggest challenge came from checking answers on the server side. For someone figuring out Python concept as he goes, it involved a lot of fists on the keyboard at the time. My attempt is posted here. There were tons of bugs (and still are) but I at least got up the nerve to try it in class. The morning I was excited to premiere it, I also found out another interestingly infuriating nugget of info: Google App Engine is blocked in China.

I gave up at the time, as it was almost summer. I was interested in helping out with the development of the Physics Problem Database project during the summer, but opportunities for sitting down and coding while on a whirlwind tour of the US seeing friends and family weren’t that numerous. It’s amazing to see how John, Andy, and others have gotten the database site together and doing functionally cool things in a short amount of time. I spent some time over the summer learning PHP and MYSQL, but was pulled back into Python when I saw the capabilities of webpy and web2py to do applications. I see a lot of features and possibility there, but fitting my ideas to that framework is beyond what I know how to do and what I have been able to figure out during my time prepping and starting school. That will come later.

I keep coming back to the fact that randomization needs to be built into the program interface from the beginning. I want students that need to practice to be able to do so with different problems each time, because that frees them from needing me to be there to either generate them myself or prevent them from creating impossible problems. I want the reassessment process to be as simple as possible, and for the lowest level skills, they don’t necessarily need me to be testing them in person. That’s what in person interviews and conversations (including those through BlueHarvest) are all about. I won’t rely on a tool like this to check proficiency, but it’s a start for giving students a tool that will get them thinking along those lines.

I’ve had the structure for how to do this in my head for a while, and I started sketching out what it would be in a new Python program last week. This morning, after learning a bit more about the newer string formatting options in Python that offer more options than basic string substitution, I hunkered down and put together what is at least a workable version of what I want to do.

Please visit here to see the code, and here to give it a shot on repl.it.

The basic structure is that every question can use either random integers, an irrational decimal value, or signed integers in its text. With all of the messiness of methods to generate and replace the random numbers inside the Question class, it is fairly easy to generate questions with random values and answers. I admit that the formatting stinks, but the structure is there. I could theoretically make some questions for students this way that could be used on Monday, but I probably won’t just yet. I think a nap is in order.

Next steps:

  • I need to work on the answer checking algorithm. At the moment it just compares an entered decimal answer to being within a certain tolerance of the calculated answer. My plan is to expand the Question definition to include another input variable for question type. Single numerical answers are one question type, Coordinates are another, and symbolic equations or expressions are yet another one I’d like to include. Based on the question type, the answer method in the Question class can be adjusted.
  • As an extension to this, I’d like to include sympy as part of this for making both question generation and answer checking. It has the ability to show that two symbolic expressions are equal to each other, among many other really nice capabilities. This will let me generate all sorts of nice Calculus and algebraic manipulation questions without too much difficulty.
  • I’d like to be able to format things nicely for algebraic questions, and possibly generate graphical questions as well.
  • The ultimate goal is to then get this nicely embedded as a web application. As I mentioned before, there is too much going on in the web2py framework for me to really get how to do this, but I think this is something I can do with a bit of help from the right sources.

I’m having a ball learning all of this, and to know that it will eventually make for a nice learning tool that students will benefit from using is a nice incentive for doing it.

2 thoughts on “Progress on Python-Powered randomized quiz generator

  1. awesome idea! I’ve tried doing something similar with excel, but it was far too restricting in terms of what I needed from it. I would love to learn how this works, but my programming ability is close to non-existent…

    I tried going on this website to see if I can learn how to use what you wrote:
    http://repl.it/Chw
    but I didn’t even understand what I could do on it!

    If you could offer some instructions, I would love to be a beta tester!

    Thanks!

    1. Hi Jim,

      If you click on the ‘play’ button, you should see the questions pop up one by one. I’ve made some changes since the weekend based on some comments, new things I’ve learned to do, and suggestions from readers and students. Check out the questions and let me know what you think.

      Thanks!

      Evan

Leave a Reply

Your email address will not be published. Required fields are marked *