Files
• main.py
main.py
```1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
```
```import random,math

class Question:
""" Question class for creating a question for use in a quiz """

def ft(self,text,randints,randdec,randsgnint):
return text.format(randints,randdec,randsgnint)

self.text = question
self.tolerance = 0.01
self.randints = []
self.randdec = []
self.randsgnint = []

for a in range(1,11):   #Creates three arrays of whole numbers, random decimals, and random signed integers for use in questions.
self.randints.append(random.randint(1,10))
self.randdec.append(math.sqrt(random.randint(1,100))*random.randint(1,10))
self.randsgnint.append(random.randint(-10,10))

self.text = self.ft(question,self.randints,self.randdec,self.randsgnint) #The function replaces all symbols in the question with the correct number types

return True
else:
return False

questionindex = ['','','']

questionindex[0] = ["Convert {1[0]:0.2f} centimeters into meters.","{1[0]}*0.01"]
questionindex[1] = ["What is the length of the line segment with endpoints ({2[1]},{2[2]}) and ({2[3]},{2[4]})?","math.sqrt(({2[3]}-{2[1]})**2 + ({2[4]}-{2[2]})**2)"]
questionindex[2] = ["Solve for x in the equation {2[1]}x - {0[2]} = {2[7]}","({2[7]}+{0[2]})*1./{2[1]}"]

#question = "What is the length of the line segment with endpoints ({2[1]},{2[2]}) and ({2[3]},{2[4]})?"