Created
August 5, 2022 19:05
-
-
Save drewkerrigan/45557d634033d5cdac371b148b02530d to your computer and use it in GitHub Desktop.
Math Problem Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 x 12 = _____ | 1 x 9 = _____ | |
2 x 4 = _____ | 2 x 5 = _____ | |
3 x 11 = _____ | 3 x 7 = _____ | |
4 x 8 = _____ | 4 x 5 = _____ | |
5 x 7 = _____ | 5 x 12 = _____ | |
6 x 3 = _____ | 6 x 11 = _____ | |
7 x 10 = _____ | 7 x 3 = _____ | |
8 x 8 = _____ | 8 x 11 = _____ | |
9 x 10 = _____ | 9 x 9 = _____ | |
10 x 11 = _____ | 10 x 11 = _____ | |
11 x 12 = _____ | 11 x 4 = _____ | |
12 x 4 = _____ | 12 x 7 = _____ | |
1 x 11 = _____ | 1 x 3 = _____ | |
2 x 8 = _____ | 2 x 6 = _____ | |
3 x 5 = _____ | 3 x 10 = _____ | |
4 x 3 = _____ | 4 x 9 = _____ | |
5 x 4 = _____ | 5 x 10 = _____ | |
6 x 5 = _____ | 6 x 12 = _____ | |
7 x 11 = _____ | 7 x 8 = _____ | |
8 x 4 = _____ | 8 x 5 = _____ | |
9 x 11 = _____ | 9 x 6 = _____ | |
10 x 4 = _____ | 10 x 7 = _____ | |
11 x 9 = _____ | 11 x 10 = _____ | |
12 x 3 = _____ | 12 x 6 = _____ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
import random | |
def main(): | |
lastB = 0 | |
lastC = 0 | |
problems = {""} | |
for outer in range(2): | |
for i in range(12): | |
a = i + 1 | |
b = random.randint(3,12) | |
while b == lastB or f"{a} x {b}" in problems: | |
b = random.randint(3,12) | |
c = random.randint(3,12) | |
while c == lastC or f"{a} x {c}" in problems: | |
c = random.randint(3,12) | |
lastB = b | |
lastC = c | |
problems.add(f"{a} x {b}") | |
problems.add(f"{a} x {c}") | |
print(f"{a:2} x {b:2} = _____ | {a:2} x {c:2} = _____") | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment