2025-12-17 20:28:58 +00:00
2025-06-23 20:44:38 -04:00
2025-10-26 12:42:35 +00:00
2025-06-23 20:44:38 -04:00
2022-12-27 14:31:58 -05:00
2021-05-21 11:08:21 -04:00
2022-12-27 14:31:58 -05:00
2022-12-27 14:31:58 -05:00
2022-12-23 00:40:06 -05:00

mathgenerator

Fork of https://github.com/lukew3/mathgenerator
Adding more Physics and Computer Science questions
As well as randomly generated questions

A math problem generator, created for the purpose of giving teachers and students the means to easily get access to random math exercises to suit their needs.

To try out generators, go to https://mathgenerator-demo.netlify.app

See CONTRIBUTING.md for information about how to contribute.

Table of Contents

Installation

The project can be install via pip

pip install mathgenerator

Usage

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

import mathgenerator

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

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

You may prefer to use import mathgenerator as mg and run functions like mg.addition() so that you don't have to type as much.
You can also use gen_by_name() to generate a random question. If no subject is specified, a random question from the whole set is chosen. If a subject is specified but no topic, a random question from that subject is chosen.
Note, if a subject and a topic are both specified, the same type of question will always be returned.

Problem/solution pairs are generated with either:

  • mathgenerator.<generator_name>() - generates a problem, solution set from the given generator name.
  • mathgenerator.genById(id) - generates a problem, solution set with generator id provided by the id parameter

You can also use get_gen_list() to return a list of all generators included in the library in the format:

[funcname, subjectname]

Documentation

Documentation can be found at https://lukew3.github.io/mathgenerator

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 3 MiB
Languages
Python 99.7%
Makefile 0.2%