-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
68 lines (62 loc) · 2.25 KB
/
models.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import random
random.seed()
# class to hold user information
class Challenger():
pass
# class for addition
class AddQuestion():
def __init__(self, level):
if level == 1:
self.int1 = random.randint(1, 9)
self.int2 = random.randint(1, 9)
self.ans = self.int1 + self.int2
elif level == 2:
self.int1 = random.randint(10, 49)
self.int2 = random.randint(10, 49)
self.ans = self.int1 + self.int2
elif level == 3:
self.int1 = random.randint(10, 99)
self.int2 = random.randint(10, 99)
self.ans = self.int1 + self.int2
elif level == 4:
self.int1 = random.randint(10, 99)
self.int2 = random.randint(100, 999)
self.ans = self.int1 + self.int2
elif level == 5:
self.int1 = random.randint(100, 999)
self.int2 = random.randint(100, 999)
self.ans = self.int1 + self.int2
else:
print("Error: Level has to be and int between 1 & 5")
class SubtractQuestion():
def __init__(self, level):
if level == 1:
num1 = random.randint(1, 9)
num2 = random.randint(1, 9)
self.int1 = max(num1, num2)
self.int2 = min(num1, num2)
self.ans = self.int1 - self.int2
elif level == 2:
self.int1 = random.randint(10, 99)
self.int2 = random.randint(1, 9)
self.ans = self.int1 - self.int2
elif level == 3:
num1 = random.randint(10, 99)
num2 = random.randint(10, 99)
self.int1 = max(num1, num2)
self.int2 = min(num1, num2)
self.ans = self.int1 - self.int2
elif level == 4:
num1 = random.randint(100, 999)
num2 = random.randint(10, 99)
self.int1 = max(num1, num2)
self.int2 = min(num1, num2)
self.ans = self.int1 - self.int2
elif level == 5:
num1 = random.randint(100, 999)
num2 = random.randint(100, 999)
self.int1 = max(num1, num2)
self.int2 = min(num1, num2)
self.ans = self.int1 - self.int2
else:
print("Error: Level has to be and int between 1 & 5")