Talk:Quizbank/QB

From Wikiversity
Jump to navigation Jump to search

Questions[edit]

From the resource:

  1. Which version of Python should I use? Two seem to be quite popular.
  2. Should adopt Object-oriented programming? I will use lists of lists to store questions: There will be a list of quizzes, and each quiz will be at a minimum a list of lines of text. Would it help to have structures like quiz.problem, problem.question and problem.answers? (here quiz refers to a quiz on Wikiversity, and problem refers to the question and answers). I would also have a problem.numberofanswers to help write the wikitext. I have ZERO experience with OOP, but it does look fun.
  3. I was advised to store all quizzes as textfiles. The exams and study guides are constructed by printing out links to a Wikiversity permalink of the quiz, as well as an arbitrary large number of exams (in two versions for in-class testing). When I used MATLAB, I stored the information as proprietory data files that only MATLAB could open. That was a big mistake. Should I worry about how long it takes to open a textfile? (I presume that the code should open each textfile only once, even though it might make 10 randomized versions of each collection of exams, right?)
  1. If you are referring to Python2 vs. Python3, go with Python3. Python2 is still considered "current", but not recommended for new development. If you had something else in mind in terms of two versions, let me know what you were considering.
  2. Object-oriented programming is more productive eventually, but much slower to start with. It's also a different mindset. You'll want to map things out well before you head down that path, vs. just jumping in with the procedural approach. The good news is that most procedural code can be converted into object-oriented code fairly easily if it is well structured to start with. Stick with good verb_noun procedure names, or maybe even noun_verb if you know you will be changing over to objects.
  3. Yes, content should be stored as text/xml, or maybe JSON. There are Python libraries for both of these. No, time to open is generally not a consideration. Time to code and time to maintain that code is the primary issue.
Dave Braunschweig (discusscontribs) 18:20, 27 February 2017 (UTC)
@Dave Braunschweig: Thanks, this is very helpful, but have one more question: I do lots of loops, counting quizzes, questions in a quiz, and answers to a given question. And my numerical problems come in what I call "renditions" instead of attempting to write a random number generator, questions involving numbers are repeated in between 10 and 25 "renditions" that are identical in every way except for the numerical values. I know that the culture of Python has a convention for capatilizing variables. When I wrote the MATLAB code I used lower/upper case "n" with text, e.g. "for nanswer = 1:Nanswer". Is this convention acceptable to the coding community?
Officially, Python uses snake_case for variables and procedures, and PascalCase for object classes. The style guide is at https://www.python.org/dev/peps/pep-0008/ . There's also a Google style guide at https://google.github.io/styleguide/pyguide.html . Note that there is a random function built into Python, and it can use the current time as a seed, so it can be considered effectively random. -- Dave Braunschweig (discusscontribs) 19:06, 1 March 2017 (UTC)
I researched the random module and discovered random.shuffle. Nice.--Guy vandegrift (discusscontribs) 05:31, 2 March 2017 (UTC)

Which Python to download[edit]

Scientific Python distributions For most users, especially on Windows, the easiest way to install the packages of the SciPy stack is to download one of these Python distributions, which include all the key packages:

  • Anaconda: A free distribution for the SciPy stack. Supports Linux, Windows and Mac.

Enthought Canopy: The free and commercial versions include the core SciPy stack packages. Supports Linux, Windows and Mac.

  • Python(x,y): A free distribution including the SciPy stack, based around the Spyder IDE. Windows only.

WinPython: A free distribution including the SciPy stack. Windows only.

  • Pyzo: A free distribution based on Anaconda and the IEP interactive development environment. Supports Linux, Windows and Mac.

Naming of quizzes[edit]

I'm not sure how to name the quizzes. One option is to use short cryptic names so that they look good on a study guide.