Sankari Karthik 2eda627cb4 Initial Commit
2021-10-08 13:36:25 +05:30
2021-10-08 13:36:25 +05:30
2021-10-06 11:05:06 -04:00
2021-02-16 15:13:05 -05:00
2021-05-21 11:08:21 -04:00
2020-10-22 01:37:37 +03:00
2021-10-08 13:36:25 +05:30
2021-10-07 00:52:02 -04:00

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 https://lukew3.com/mathgenerator

See CONTRIBUTING.md for information about how to contribute.

Table of Contents

Installation

The project can be install via pip

pip install mathgenerator

Basic Usage

Here is an example of how you would generate an addition problem:

from mathgenerator import mathgen

#generate an addition problem
problem, solution = mathgen.addition()

#another way to generate an addition problem using genById()
problem, solution = mathgen.genById(0)

Creating a worksheet

If you wish to create a worksheet, you can use the worksheetgen package. Install this with pip install worksheetgen. Here is an example of how a worksheet would be generated.

from mathgenerator import mathgen
from worksheetgen.wg import Worksheet

worksheet = Worksheet("Worksheet title")
worksheet.add_instruction("Instructions")
# Writes 10 problems generated with id 1, [0] at the end specifies to take problem, and not solution.
for _ in range(10):
	worksheet.add_problem(mathgen.genById(1)[0])
worksheet.write_pdf()

This creates the pdf ws.pdf in your current directory

Documentation

  • getGenList() returns a list of all generators in the repository in the format [id, title, self, funcname, subjectname]

  • genById(id) generates a problem, solution set with generator id id in the format [problem, solution]

  • Pass the kwarg format=latex to return problem and solution set as latex. If latex is not available for that generator, the problem will return the string "Latex unavailable"

  • Pass the kwarg format=raw to return just the raw data for each generator. An array of each variable necessary to the generator is returned.

List of Generators

algebra

Id Skill Example problem Example Solution Function Name Kwargs

basic_math

Id Skill Example problem Example Solution Function Name Kwargs

calculus

Id Skill Example problem Example Solution Function Name Kwargs

computer_science

Id Skill Example problem Example Solution Function Name Kwargs

geometry

Id Skill Example problem Example Solution Function Name Kwargs

misc

Id Skill Example problem Example Solution Function Name Kwargs

statistics

Id Skill Example problem Example Solution Function Name Kwargs
Description
A math problem generator, created for the purpose of giving self-studying students and teaching organizations the means to easily get access to high-quality, generated math problems to suit their needs.
Readme MIT 2.2 MiB
Languages
Python 99.6%
Makefile 0.3%