set param defaults on addition and subtraction, readme formatting

This commit is contained in:
lukew3
2020-10-05 13:41:06 -04:00
parent c496bf8146
commit 0e08c1e6a9
2 changed files with 12 additions and 10 deletions

View File

@@ -5,11 +5,11 @@ To try out generators, go to todarith.ml/generate
## List of Generators
| Skill | Id | Difficulty | Current Status | Contributors | Example problem | Example Solution |
|----------------------------|------|---------------|----------------|--------------|-----------------|-------------------|
| Addition | 2 | Low | Complete | @lukew3 | 1+5= | 6 |
| Subtraction | 3 | Low | Complete | @lukew3 | 9-4= | 5 |
| Multiplication | 4 | Low | In Progress | @lukew3 | 4*6= | 24 |
| Division | 5 | Low | In Progress | @lukew3 | 4/2= | 2 |
| Factoring | - | Medium | Not Started | - | x^2+x-6 | (x-2)(x+3) |
| Power Rule Differentiation | - | Medium | Not Started | - | x^5 | 5x^4 |
| Id | Skill | Ex. problem | Ex. Solution | Usage | Status |
|------|----------------------------|-------------|---------------|----------------------------------|-------------|
| 2 | Addition | 1+5= | 6 | addition(maxSum, maxAddend) | Complete |
| 3 | Subtraction | 9-4= | 5 | subtraction(maxMinuend, maxDiff) | Complete |
| 4 | Multiplication | 4*6= | 24 | | In Progress |
| 5 | Division | 4/2= | 2 | | In Progress |
| - | Factoring | x^2+x-6 | (x-2)(x+3) | | Not Started |
| - | Power Rule Differentiation | x^5 | 5x^4 | | Not Started |

View File

@@ -1,6 +1,6 @@
import random
def addition(maxSum, maxAddend):
def addition(maxSum = 99, maxAddend = 50):
"""
DESCRIPTION:
Generates addition problems with positive addends less than maxAddend and sum less than maxSum
@@ -18,7 +18,7 @@ def addition(maxSum, maxAddend):
solution = str(c)
return problem, solution
def subtraction(maxDiff, maxMinuend):
def subtraction(maxMinuend = 99, maxDiff = 99):
"""
DESCRIPTION:
Generates subtraction problems with difference between 0 and maxDiff. Minuend and subtrahend are between 0 and maxMinuend.
@@ -35,3 +35,5 @@ def subtraction(maxDiff, maxMinuend):
problem = str(a) + "-" + str(b) + "="
solution = str(c)
return problem, solution
print(subtraction())