mirror of
https://github.com/DeaDvey/mathgenerator.git
synced 2025-11-28 06:25:23 +01:00
1.0.1 formatting fixes
This commit is contained in:
@@ -8,26 +8,16 @@ This project was created with contributions at it's core. We need your help to e
|
||||
As of right now, all of our generators are being coded in python. Your generator will be an object of the Generator class and will have a function created seperately.
|
||||
Your object instantiation should follow this format:
|
||||
```
|
||||
#g<id> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||
#<title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||
|
||||
```
|
||||
and look something like this:
|
||||
```
|
||||
g2 = Generator("Addition", 2, "a+b=", "c", addition)
|
||||
addition = Generator("Addition", 2, "a+b=", "c", additionFunc)
|
||||
```
|
||||
Your function should look something like the following:
|
||||
```
|
||||
def addition(maxSum, maxAddend):
|
||||
"""
|
||||
DESCRIPTION:
|
||||
Generates addition problems with positive addends less than maxAddend and sum less than maxSum
|
||||
SKILLID:
|
||||
2
|
||||
PROBLEM:
|
||||
"a+b="
|
||||
SOLUTION:
|
||||
"c"
|
||||
"""
|
||||
def additionFunc(maxSum, maxAddend):
|
||||
a = random.randint(0, maxAddend)
|
||||
b = random.randint(0, min((maxSum-a), maxAddend)) #The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
||||
c = a+b
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# mathGenerator
|
||||
# mathgenerator
|
||||
A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to random math problems to suit their needs.
|
||||
|
||||
To try out generators, go to http://todarith.ml/generate
|
||||
|
||||
@@ -19,7 +19,7 @@ class Generator:
|
||||
|
||||
# || Functions
|
||||
|
||||
def addition(maxSum = 99, maxAddend = 50):
|
||||
def additionFunc(maxSum = 99, maxAddend = 50):
|
||||
a = random.randint(0, maxAddend)
|
||||
b = random.randint(0, min((maxSum-a), maxAddend)) #The highest value of b will be no higher than the maxsum minus the first number and no higher than the maxAddend as well
|
||||
c = a+b
|
||||
@@ -38,11 +38,6 @@ def subtraction(maxMinuend = 99, maxDiff = 99):
|
||||
# || Class Instances
|
||||
|
||||
#Format is:
|
||||
#g<id> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||
g2 = Generator("Addition", 2, "a+b=", "c", addition)
|
||||
g3 = Generator("Subtraction", 3, "a-b=", "c", subtraction)
|
||||
|
||||
# || Testing Zone
|
||||
print(g2)
|
||||
print(g2())
|
||||
print(g3())
|
||||
#<title> = Generator("<Title>", <id>, <generalized problem>, <generalized solution>, <function name>)
|
||||
addition = Generator("Addition", 2, "a+b=", "c", additionFunc)
|
||||
subtraction = Generator("Subtraction", 3, "a-b=", "c", subtractionFunc)
|
||||
8
setup.py
8
setup.py
@@ -1,10 +1,10 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
name='mathGenerator',
|
||||
version='1.0.0',
|
||||
name='mathgenerator',
|
||||
version='1.0.1',
|
||||
description='An open source solution for generating math problems',
|
||||
url='https://github.com/todarith/mathGenerator',
|
||||
url='https://github.com/todarith/mathgenerator',
|
||||
author='Luke Weiler',
|
||||
author_email='lukew25073@gmail.com',
|
||||
license='MIT',
|
||||
@@ -14,7 +14,7 @@ setup(
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'mathGenerator=mathGenerator.mainGen:main'
|
||||
'mathgenerator=mathgenerator.generator:main'
|
||||
],
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user