januschung / math-worksheet-generator

Create basic addition, subtraction, multiplication and division practice questions with the answer sheet
GNU General Public License v2.0
507 stars 91 forks source link

Allow subset of operations #38

Open blustrini opened 3 years ago

blustrini commented 3 years ago

Allow subset of operations, keeping back-compatibility (issue #37).

Operation type still passed as --type, but can now concatenate operation types, e.g. --type=+- to do addition and subtraction. --type=mix still does all the operations.

Types are now passed to the object as a tuple of allowed operation strings, e.g. ('+', '-'), which saved to the attribute all_types. Method generate_question then draws from self.all_types every time.

This is my first ever pull-request, btw so let me know if I am doing anything wrong.

blustrini commented 3 years ago

Changed the input argument to types and didn't change the tests, so they have failed.

blustrini commented 3 years ago

Tests seem to pass, but probably needs some more tests to test the new functionality.