title: Data Structure for Math formulae
body: <p>I am working on a python script that generates pdfs for math-tests via pylatex.
  So far I am using</p>
  <pre><code>str(random.randint(8,32)) +' + ' + str(random.randint(8,121))
  </code></pre>
  <p>and similar for generating randomized assignments.</p>
  <p>I don't want to hard-code everything like above but I want to use a database approach to store possible assignments.
  My idea in this direction is a relational database</p>
  <pre><code>(student) --n (assignment_type)
  </code></pre>
  <p>where the students each get personilized assignments, for instance Peter will get assigments of the type</p>
  <pre><code>( (random sign) (random number 2-8) x (+ or -) (random sign) (random number))    (*)
  </code></pre>
  <p>and</p>
  <pre><code>( (random number 2323-9999):11)
  </code></pre>
  <p>I am unsure on how to save this datastructure in a database and how to translate it into python code.
  My idea here is for the database table 'assignment_type':</p>
  <pre><code>INT number of randomized vars
  INT number of signs
  ARRAY List of signs
  ARRAY (lower und upper bound for each random number)
  STRING '(s1r1s2r1)'
  </code></pre>
  <p>Where '(s1r1s2(s3r1))' would be translated in python to the above problem (*) (&quot;( sign1 random1 sign2 (sign3)random2)&quot;)
  I am very unsure if this way of handling the problem is a stupid idea. I ask you hereby to review my approach and if possible point me in a better direction of handling this kind of data-structure.</p>